]> git.ipfire.org Git - thirdparty/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>
Wed, 4 May 2016 22:45:50 +0000 (18:45 -0400)
commitca9180ad63b4f369880f4f13c0a4be3cb7060248
tree25b75b60f33d408df0c903dd3b01ba6ff402f84b
parent8ceb0feae37ec06684972ce036238793b2ab3830
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
(cherry picked from commit 3cc2a9e0d412776a07780b090cf286cc603cea84)
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]