[libvirt] [PATCH] Make sure DNSMASQ_STATE_DIR exists

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

On 04/24/2011 04:02 AM, Guido Günther wrote:
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;
ACK.

On Mon, Apr 25, 2011 at 03:05:51AM -0400, Laine Stump wrote:
On 04/24/2011 04:02 AM, Guido Günther wrote:
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;
ACK. Pushed. Thanks, -- Guido
participants (2)
-
Guido Günther
-
Laine Stump