[Libguestfs] [PATCH] inspector: fix formatting of xpath result (RHBZ#1212680)

Richard W.M. Jones rjones at redhat.com
Wed Apr 29 21:26:43 UTC 2015


On Wed, Apr 29, 2015 at 03:00:10PM +0200, Pino Toscano wrote:
> Discard blank nodes when reading the XML from stdin, while enabling
> formatting in output nodes.
> ---
>  inspector/inspector.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/inspector/inspector.c b/inspector/inspector.c
> index 1863de0..412384a 100644
> --- a/inspector/inspector.c
> +++ b/inspector/inspector.c
> @@ -769,7 +769,7 @@ do_xpath (const char *query)
>    xmlSaveCtxtPtr saveCtx;
>    xmlNodePtr wrnode;
>  
> -  doc = xmlReadFd (STDIN_FILENO, NULL, "utf8", 0);
> +  doc = xmlReadFd (STDIN_FILENO, NULL, "utf8", XML_PARSE_NOBLANKS);
>    if (doc == NULL) {
>      fprintf (stderr, _("%s: unable to parse XML from stdin\n"), guestfs_int_program_name);
>      exit (EXIT_FAILURE);
> @@ -795,7 +795,7 @@ do_xpath (const char *query)
>      if (nodes == NULL)
>        break;
>  
> -    saveCtx = xmlSaveToFd (STDOUT_FILENO, NULL, XML_SAVE_NO_DECL);
> +    saveCtx = xmlSaveToFd (STDOUT_FILENO, NULL, XML_SAVE_NO_DECL | XML_SAVE_FORMAT);
>      if (saveCtx == NULL) {
>        fprintf (stderr, _("%s: xmlSaveToFd failed\n"), guestfs_int_program_name);
>        exit (EXIT_FAILURE);

Looks good, ACK.

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