
On Fri, Dec 12, 2008 at 11:38:59AM -0800, David Lutterkort wrote:
On Fri, 2008-12-12 at 19:27 +0100, Guido Günther wrote:
diff --git a/src/qemu_driver.c b/src/qemu_driver.c index d8b87e4..57a396c 100644 --- a/src/qemu_driver.c +++ b/src/qemu_driver.c @@ -183,6 +183,46 @@ qemudAutostartConfigs(struct qemud_driver *driver) { }
+static int +qemudGetProcFD(pid_t pid, int fdnum) +{ + int fd; + +#ifdef __linux__ + char *path = NULL; + + if (!asprintf(&path, "/proc/%d/fd/%d", pid, fdnum)) { + qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, NULL); + return -1; + }
One more use of asprintf that needs to set path = NULL on error.
This is crying out for us to write a virASprintf() that explicitly always sets path = NULL upon failure. And then blacklist 'asprintf' in make syntax-check. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|