[Libguestfs] [PATCH] Replace shell_quote function with %Q and %R printf specifiers.

Daniel P. Berrange berrange at redhat.com
Mon Jul 27 22:09:01 UTC 2009


On Mon, Jul 27, 2009 at 10:42:17PM +0100, Richard W.M. Jones wrote:
> 
> At the moment the daemon code contains an incredibly hairy function
> called shell_quote for safely quoting strings passed to the shell.
> 
> The patch replaces that with a glibc custom printf format (actually
> two, but very closely related), %Q and %R.

Wow, I didn't know you could register custom printf formats !

> +  /* http://udrepper.livejournal.com/20948.html */
> +  register_printf_specifier ('Q', print_shell_quote, print_arginfo);
> +  register_printf_specifier ('R', print_sysroot_shell_quote, print_arginfo);

Perhaps want to see if you can also make it work with

/* Obsolete interface similar to register_printf_specifier.  It can only
   handle basic data types because the ARGINFO callback does not return
   information on the size of the user-defined type.  */

extern int register_printf_function (int __spec, printf_function __func,
                                     printf_arginfo_function __arginfo)


so that libguestfs still compiles on older distros like RHEL-5/EPEL5, 
unless they're explicitly out of scope as targets now ?

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the Libguestfs mailing list