[Libguestfs] [PATCH 2/2] daemon: Remove redundant fork in commandrvf

Richard W.M. Jones rjones at redhat.com
Fri Dec 14 15:20:52 UTC 2012


On Thu, Dec 13, 2012 at 03:22:39PM +0000, Matthew Booth wrote:
> Currently the code is doing a redundant fork when passed the
> COMMAND_FLAG_CHROOT_COPY_FILE_TO_STDIN flag. The additional sub-process does a
> chroot() which has no effect because all file handles are already open at that
> point, then simply copies its input to its output.
> 
> This change simply replaces the above with a dup2 of the passed file handle to
> STDIN of the command process.

NACK.  This removes the chroot call, so I don't see how it can
be right.

Did you read the comment and the linked bug?

 * COMMAND_FLAG_CHROOT_COPY_FILE_TO_STDIN: For running external
 * commands on chrooted files correctly (see RHBZ#579608) specifying
 * this flag causes another process to be forked which chroots into
 * sysroot and just copies the input file to stdin of the specified
 * command.  The file descriptor is ORed with the flags, and that file
 * descriptor is always closed by this function.  See hexdump.c for an
 * example of usage.

https://bugzilla.redhat.com/show_bug.cgi?id=579608

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top




More information about the Libguestfs mailing list