On Thu, 2011-02-10 at 12:20 +0100, Raphael Pinson wrote:
> From: Raphaël Pinson <[email protected]>
> 
> ---
>  src/augtool.c |   18 +++++++++++++++++-
>  1 files changed, 17 insertions(+), 1 deletions(-)

ACK. That's a very useful option. I committed a slight variation of your
patch:

> diff --git a/src/augtool.c b/src/augtool.c
> index 7de8e9d..4042618 100644
> --- a/src/augtool.c
> +++ b/src/augtool.c
> @@ -1193,6 +1200,15 @@ static int main_loop(void) {
>          }
>  
>          if (line == NULL) {
> +            if (!isatty(fileno(stdin)) && interactive && !in_interactive) {
> +               in_interactive = true;
> +               echo = true;
> +               // reopen in and out streams
> +               rl_instream = fopen("/dev/tty", "r");
> +               rl_outstream = fopen("/dev/stdout", "w");
> +               continue;
> +            }
> +

There's two problems with the above: (1) we might end up leaking
rl_outstream (not that big a deal here, but still) and (2) there's zero
error checking for the fopen. I addressed both in the patch I committed.

David

_______________________________________________
augeas-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/augeas-devel

Reply via email to