mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-15 17:15:18 +00:00
dnsmasq: Fix parsing of the version number
If the debugging is enabled, the virCommand subsystem catches debug messages in the command output as well. In that case, we can't assume the string corresponding to command's stdout will start with specific prefix. But the prefix can be moved deeper in the string. This bug shows 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. (cherry picked from commit 5114431396fd125b6ebe4d1a20a981111f948ee7)
This commit is contained in:
parent
9b625cbcf0
commit
0617864e2c
@ -641,9 +641,9 @@ dnsmasqCapsSetFromBuffer(dnsmasqCapsPtr caps, const char *buf)
|
||||
|
||||
caps->noRefresh = true;
|
||||
|
||||
p = STRSKIP(buf, DNSMASQ_VERSION_STR);
|
||||
if (!p)
|
||||
if (!(p = strstr(buf, DNSMASQ_VERSION_STR)))
|
||||
goto fail;
|
||||
p += sizeof(DNSMASQ_VERSION_STR) - 1;
|
||||
virSkipSpaces(&p);
|
||||
if (virParseVersionString(p, &caps->version, true) < 0)
|
||||
goto fail;
|
||||
|
Loading…
x
Reference in New Issue
Block a user