]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: only parse basename when determining emulator properties
authorEric Blake <eblake@redhat.com>
Mon, 26 Aug 2013 22:04:19 +0000 (16:04 -0600)
committerEric Blake <eblake@redhat.com>
Fri, 6 Sep 2013 15:21:02 +0000 (09:21 -0600)
commit6a373fb2c95300d632a7371c893a301364f8dcb5
tree31c9c2c63721ab0a9e6b92649d84bbf2826f681e
parent744fb50831ae92780d3a5e78ed3ced0cc5eacd36
qemu: only parse basename when determining emulator properties

'virsh domxml-from-native' and 'virsh qemu-attach' could misbehave
for an emulator installed in (a somewhat unlikely) location
such as /usr/local/qemu-1.6/qemu-system-x86_64 or (an even less
likely) /opt/notxen/qemu-system-x86_64.  Limit the strstr seach
to just the basename of the file where we are assuming details
about the binary based on its name.

While testing, I accidentally triggered a core dump during strcmp
when I forgot to set os.type on one of my code paths; this patch
changes such a coding error to raise a nicer internal error instead.

* src/qemu/qemu_command.c (qemuParseCommandLine): Compute basename
earlier.
* src/conf/domain_conf.c (virDomainDefPostParseInternal): Avoid
NULL deref.

Signed-off-by: Eric Blake <eblake@redhat.com>
src/conf/domain_conf.c
src/qemu/qemu_command.c