]> git.ipfire.org Git - thirdparty/libvirt.git/commit
nss: Don't fail on empty files v5.10.0-rc2
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 28 Nov 2019 13:25:07 +0000 (14:25 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 28 Nov 2019 14:37:41 +0000 (15:37 +0100)
commitd7dd4e1f899cbcf633efe234c8b1a24a3da842b8
tree1f86a3190abc620bc292f8fa2e53e7cf144b9c16
parent8d9ca128f1604611822db4c7685024b2306498dd
nss: Don't fail on empty files

Before we rewrote nss plugin so that it doesn't use libvirt's
internal functions it used virLeaseReadCustomLeaseFile() to parse
.status files. After the rewrite it's using read() + yajl_parse()
+ yajl_complete_parse(). There's one catch though,
virLeaseReadCustomLeaseFile() skipped over empty files.

An empty .status file is created when a network is started. This
is because we configure dnsmasq to use our leasehelper. So the
first thing it does it calls it as follows:

  DNSMASQ_INTERFACE=virbr0 /usr/libexec/libvirt_leaseshelper init

which causes the leasehelper to create empty virbr0.status file.
If there is only one libvirt network then that is no problem -
there are no other .status files to parse anyway. But if there
are two or more networks then the first empty .status file causes
whole parsing process and subsequently the whole name lookup
process to fail.

Fixes: v5.7.0-rc1~343
Reported-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
tools/nss/libvirt_nss_leases.c