]> xenbits.xensource.com Git - libvirt.git/commit
virconf: Handle conf file without ending newline
authorCole Robinson <crobinso@redhat.com>
Thu, 21 Apr 2016 00:25:31 +0000 (20:25 -0400)
committerCole Robinson <crobinso@redhat.com>
Thu, 21 Apr 2016 22:14:07 +0000 (18:14 -0400)
commit3cc2a9e0d412776a07780b090cf286cc603cea84
tree57f3edd5a05ab0aa4d7ca8b7143f5be9953e0e9f
parent81f3839f876983ac68fa65730879a21def987921
virconf: Handle conf file without ending newline

$ echo -n 'log_level=1' > ~/.config/libvirt/libvirtd.conf
$ libvirtd --timeout=10
2014-10-10 10:30:56.394+0000: 6626: info : libvirt version: 1.1.3.6, package: 1.fc20 (Fedora Project, 2014-09-08-17:50:42, buildvm-05.phx2.fedoraproject.org)
2014-10-10 10:30:56.394+0000: 6626: error : main:1261 : Can't load config file: configuration file syntax error: /home/rjones/.config/libvirt/libvirtd.conf:1: expecting a value: /home/rjones/.config/libvirt/libvirtd.conf

Rather than try to fix this in the depths of the parser, just catch
the case when a config file doesn't end in a newline, and manually
append a newline to the content before parsing

https://bugzilla.redhat.com/show_bug.cgi?id=1151409
cfg.mk
src/util/virconf.c
tests/confdata/no-newline.conf [new file with mode: 0644]
tests/confdata/no-newline.out [new file with mode: 0644]