[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [Libvir] [PATCH] (for discussion) DHCP host mappings using 3 arrays API
- From: Jim Meyering <jim meyering net>
- To: "Richard W.M. Jones" <rjones redhat com>
- Cc: libvir-list redhat com
- Subject: Re: [Libvir] [PATCH] (for discussion) DHCP host mappings using 3 arrays API
- Date: Wed, 27 Feb 2008 17:27:33 +0100
"Richard W.M. Jones" <rjones redhat com> wrote:
> Here's the final version of the "3 arrays" version of the patch, with
> the memory corruptor fixed.
...
> Index: src/qemu_driver.c
> ===================================================================
> RCS file: /data/cvs/libvirt/src/qemu_driver.c,v
> retrieving revision 1.57
> diff -u -r1.57 qemu_driver.c
> --- src/qemu_driver.c 27 Feb 2008 04:37:07 -0000 1.57
> +++ src/qemu_driver.c 27 Feb 2008 16:08:34 -0000
> @@ -925,6 +930,7 @@
> dhcpStartDhcpDaemon(virConnectPtr conn,
> struct qemud_network *network)
> {
> + char buf[PATH_MAX];
> char **argv;
> int ret, i;
>
> @@ -934,6 +940,15 @@
> return -1;
> }
>
> + /* Touch the DHCP hosts file so it exists before dnsmasq starts up. */
> + snprintf (buf, sizeof buf, DHCP_HOSTS_FORMAT, network->def->name);
> + ret = open (buf, O_CREAT|O_WRONLY, 0644);
> + if (ret == -1) {
> + qemudReportError (conn, NULL, NULL, VIR_ERR_SYSTEM_ERROR,
> + "%s: %s", buf, strerror (errno));
> + return -1;
> + }
> +
> argv = NULL;
> if (qemudBuildDnsmasqArgv(conn, network, &argv) < 0)
> return -1;
Whoops. You'll want to close that file descriptor.
E.g., put this right before "argv = NULL;":
if (close (ret))
return -1;
It'd be nice to declare a new variable, say fd, for that bit.
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]