Re: [PATCH] dnsmasq: Fix parsing of the version number

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 06, 2012 at 14:00:00 +0100, Michal Privoznik wrote:
> If debugging is enabled, the debug messages are sent to stderr.
> Moreover, if a command has catching of stderr set, the messages
> gets mixed with stdout output (assuming both outputs are stored
> in the same variable). The resulting string then doesn't
> necessarily have to start with desired prefix then. This bug
> exposes itself when parsing dnsmasq output:
> 
> 2012-12-06 11:18:11.445+0000: 18491: error :
> dnsmasqCapsSetFromBuffer:664 : internal error cannot parse
> /usr/sbin/dnsmasq version number in '2012-12-06
> 11:11:02.232+0000: 18492: debug : virFileClose:72 : Closed fd 22'
> 
> We can clearly see that the output of dnsmasq --version doesn't
> start with expected "Dnsmasq version " string but a libvirt debug
> output.
> ---
>  src/util/dnsmasq.c |    2 --
>  1 files changed, 0 insertions(+), 2 deletions(-)
> 
> diff --git a/src/util/dnsmasq.c b/src/util/dnsmasq.c
> index de0293a..a627ed2 100644
> --- a/src/util/dnsmasq.c
> +++ b/src/util/dnsmasq.c
> @@ -715,7 +715,6 @@ dnsmasqCapsRefreshInternal(dnsmasqCapsPtr caps, bool force)
>  
>      cmd = virCommandNewArgList(caps->binaryPath, "--version", NULL);
>      virCommandSetOutputBuffer(cmd, &version);
> -    virCommandSetErrorBuffer(cmd, &version);
>      virCommandAddEnvPassCommon(cmd);
>      virCommandClearCaps(cmd);
>      if (virCommandRun(cmd, NULL) < 0) {
> @@ -727,7 +726,6 @@ dnsmasqCapsRefreshInternal(dnsmasqCapsPtr caps, bool force)
>  
>      cmd = virCommandNewArgList(caps->binaryPath, "--help", NULL);
>      virCommandSetOutputBuffer(cmd, &help);
> -    virCommandSetErrorBuffer(cmd, &help);
>      virCommandAddEnvPassCommon(cmd);
>      virCommandClearCaps(cmd);
>      if (virCommandRun(cmd, NULL) < 0) {

ACK, this looks like the right solution.

Jirka

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]