[Libguestfs] [PATCH v2] fuse: use the configured program name

Richard W.M. Jones rjones at redhat.com
Fri Feb 3 15:10:56 UTC 2017


On Thu, Feb 02, 2017 at 02:32:45PM +0100, Pino Toscano wrote:
> When initializing FUSE, use the program name as set (either
> automatically or manually) in the guestfs handle.
> ---
>  lib/fuse.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/lib/fuse.c b/lib/fuse.c
> index 0180f8f..98bbc8d 100644
> --- a/lib/fuse.c
> +++ b/lib/fuse.c
> @@ -989,8 +989,7 @@ guestfs_impl_mount_local (guestfs_h *g, const char *localmountpoint,
>      return -1;
>  
>    /* Create the FUSE 'args'. */
> -  /* XXX we don't have a program name */
> -  if (fuse_opt_add_arg (&args, "guestfs_mount_local") == -1) {
> +  if (fuse_opt_add_arg (&args, g->program) == -1) {
>    arg_error:
>      perrorf (g, _("fuse_opt_add_arg: %s"), localmountpoint);
>      fuse_opt_free_args (&args);

ACK.

I think there is a bug in our documentation, see patch below.

Rich.

>From 935beccab9180b5883c6a214c739a161802b4853 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones at redhat.com>
Date: Fri, 3 Feb 2017 15:08:52 +0000
Subject: [PATCH] lib: g->program is now never the empty string.

The getprogname module either sets g->program to a string derived from
argv[0] or fails at compile time.

Fixes commit eea210dbf7d781bc253f927977868dbc6776f20d.
---
 generator/actions.ml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/generator/actions.ml b/generator/actions.ml
index e8b0ba5..990eacb 100644
--- a/generator/actions.ml
+++ b/generator/actions.ml
@@ -3184,8 +3184,8 @@ Set the program name.  This is an informative string which the
 main program may optionally set in the handle.
 
 When the handle is created, the program name in the handle is
-set to the basename from C<argv[0]>.  If that was not possible,
-it is set to the empty string (but never C<NULL>)." };
+set to the basename from C<argv[0]>.  The program name can never
+be C<NULL>." };
 
   { defaults with
     name = "get_program"; added = (1, 21, 29);
-- 
2.10.2


-- 
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