aboutsummaryrefslogtreecommitdiff
path: root/hw/xen_domainbuild.c
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2010-01-20 00:56:21 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2010-01-26 14:59:20 -0600
commitacdc3f0c59d076099c63425158c4811aaee984b6 (patch)
treee9aca716d9955605c05022dcbfdbd0a9c65f9de5 /hw/xen_domainbuild.c
parentfb7e378cf9cba1d75d066da4d99f23547627b8ae (diff)
downloadqemu-acdc3f0c59d076099c63425158c4811aaee984b6.zip
qemu-acdc3f0c59d076099c63425158c4811aaee984b6.tar.gz
qemu-acdc3f0c59d076099c63425158c4811aaee984b6.tar.bz2
check pipe() return value
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/xen_domainbuild.c')
-rw-r--r--hw/xen_domainbuild.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/hw/xen_domainbuild.c b/hw/xen_domainbuild.c
index 20d731d..2f59856 100644
--- a/hw/xen_domainbuild.c
+++ b/hw/xen_domainbuild.c
@@ -156,15 +156,18 @@ quit:
return;
}
-static void xen_domain_watcher(void)
+static int xen_domain_watcher(void)
{
int qemu_running = 1;
int fd[2], i, n, rc;
char byte;
- pipe(fd);
+ if (pipe(fd) != 0) {
+ qemu_log("%s: Huh? pipe error: %s\n", __FUNCTION__, strerror(errno));
+ return -1;
+ }
if (fork() != 0)
- return; /* not child */
+ return 0; /* not child */
/* close all file handles, except stdio/out/err,
* our watch pipe and the xen interface handle */
@@ -238,7 +241,9 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk,
}
qemu_log("xen: created domain %d\n", xen_domid);
atexit(xen_domain_cleanup);
- xen_domain_watcher();
+ if (xen_domain_watcher() == -1) {
+ goto err;
+ }
xenstore_domain_init1(kernel, ramdisk, cmdline);