[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] [PATCH 2/3] daemon: Fix for commands working on absolute symbolic links



On Thu, May 06, 2010 at 10:04:09PM +0100, Richard W.M. Jones wrote:
> +        if (xwrite (1, buffer, n) == -1)
> +          _exit (EXIT_FAILURE);

To implement 'head' I had to change this to:

        if (xwrite (1, buffer, n) == -1)
          /* EPIPE error indicates the command process has exited
           * early.  If the command process fails that will be caught
           * by the daemon, and if not, then it's not an error.
           */
          _exit (errno == EPIPE ? EXIT_SUCCESS : EXIT_FAILURE);

This is of course because the head process exits early, so causing
this process to get EPIPE.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://et.redhat.com/~rjones/libguestfs/
See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]