[Libguestfs] [PATCH libguestfs 2/5] guestfish: write --help to stdout, use gnulib's progname module

Richard W.M. Jones rjones at redhat.com
Mon Aug 24 16:04:33 UTC 2009


On Mon, Aug 24, 2009 at 06:00:19PM +0200, Jim Meyering wrote:
> @@ -186,6 +201,11 @@ main (int argc, char *argv[])
>        (argv[0][0] != '/' || strstr (argv[0], "/.libs/lt-") != NULL))
>      guestfs_set_path (g, "appliance:" GUESTFS_DEFAULT_PATH);
> 
> +  /* getopt_long uses argv[0], so give it the sanitized name, too.
> +     But only temporarily.  */
> +  char *real_argv0 = argv[0];
> +  argv[0] = bad_cast (program_name);

ACK.  Do you think you could change that comment to make it really
clear that this piece of code mustn't ever move above the path munging
done in the preceeding lines.

Thanks,

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/




More information about the Libguestfs mailing list