mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 07:05:28 +00:00
Create directory for lease files if it's missing
If we don't autostart a network it's not being created. Debian Bug http://bugs.debian.org/715200
This commit is contained in:
parent
cbe31911ad
commit
dc4cdc57c7
@ -74,8 +74,9 @@
|
|||||||
|
|
||||||
#ifdef HAVE_LIBPCAP
|
#ifdef HAVE_LIBPCAP
|
||||||
|
|
||||||
# define LEASEFILE LOCALSTATEDIR "/run/libvirt/network/nwfilter.leases"
|
# define LEASEFILE_DIR LOCALSTATEDIR "/run/libvirt/network/"
|
||||||
# define TMPLEASEFILE LOCALSTATEDIR "/run/libvirt/network/nwfilter.ltmp"
|
# define LEASEFILE LEASEFILE_DIR "nwfilter.leases"
|
||||||
|
# define TMPLEASEFILE LEASEFILE_DIR "nwfilter.ltmp"
|
||||||
|
|
||||||
struct virNWFilterSnoopState {
|
struct virNWFilterSnoopState {
|
||||||
/* lease file */
|
/* lease file */
|
||||||
@ -1881,6 +1882,11 @@ virNWFilterSnoopLeaseFileRefresh(void)
|
|||||||
{
|
{
|
||||||
int tfd;
|
int tfd;
|
||||||
|
|
||||||
|
if (virFileMakePathWithMode(LEASEFILE_DIR, 0700) < 0) {
|
||||||
|
virReportError(errno, _("mkdir(\"%s\")"), LEASEFILE_DIR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (unlink(TMPLEASEFILE) < 0 && errno != ENOENT)
|
if (unlink(TMPLEASEFILE) < 0 && errno != ENOENT)
|
||||||
virReportSystemError(errno, _("unlink(\"%s\")"), TMPLEASEFILE);
|
virReportSystemError(errno, _("unlink(\"%s\")"), TMPLEASEFILE);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user