[Libguestfs] [PATCH v2] lib/info: Remove /dev/fd hacking and pass a true filename to qemu-img info.

Richard W.M. Jones rjones at redhat.com
Tue Jan 23 19:37:51 UTC 2018


On Fri, Jan 12, 2018 at 03:32:31PM +0100, Pino Toscano wrote:
> On Friday, 15 December 2017 09:26:29 CET Richard W.M. Jones wrote:
> > It obscures what's really going on and is no longer necessary
> > for the original purpose.
> > 
> > This reverts commit d50cb7bbb4cc18f69ea1425e9f5cee9685825f95.
> > 
> > See also:
> > 
> >   https://www.redhat.com/archives/libguestfs/2017-November/thread.html#00226
> >   https://www.redhat.com/archives/libguestfs/2017-December/thread.html#00044
> > ---
> 
> Mostly LGTM -- a couple of notes below.
> 
> > -  guestfs_int_cmd_clear_close_files (cmd);
> 
> Don't we want this regardless?

I don't think so.  Previously we needed it because we wanted to pass
the open fd file descriptor to the qemu-img subprocess.  However as
we're now passing the filename I don't believe it is needed (ie. we
_do_ need to close other file descriptors).

> > +  if (filename[0] == '/')
> > +    guestfs_int_cmd_add_arg (cmd, filename);
> > +  else {
> > +    rel_filename = safe_asprintf (g, "./%s", filename);
> > +    guestfs_int_cmd_add_arg (cmd, rel_filename);
> 
> There's guestfs_int_cmd_add_arg_format, so that can be used to avoid
> the temporary string.

Ah, good point.

I'm going to push this with the second change but not the first.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW




More information about the Libguestfs mailing list