[libvirt] [PATCH] Make sure DNSMASQ_STATE_DIR exists

Guido Günther agx at sigxcpu.org
Sun Apr 24 08:02:23 UTC 2011


Hi,

otherwise the directory returned by networkDnsmasqLeaseFileName will not
be created if ipdef->nhosts == 0 in networkBuildDnsmasqArgv.

O.k. to apply?

Cheers,
 -- Guido

---
 src/network/bridge_driver.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 8b5c1b6..ed78710 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -662,6 +662,13 @@ networkStartDhcpDaemon(virNetworkObjPtr network)
         goto cleanup;
     }
 
+    if ((err = virFileMakePath(DNSMASQ_STATE_DIR)) != 0) {
+        virReportSystemError(err,
+                             _("cannot create directory %s"),
+                             DNSMASQ_STATE_DIR);
+        goto cleanup;
+    }
+
     cmd = virCommandNew(DNSMASQ);
     if (networkBuildDnsmasqArgv(network, ipdef, pidfile, cmd) < 0) {
         goto cleanup;
-- 
1.7.4.1




More information about the libvir-list mailing list