From de9db14c701dbfb82a7a0ebc49c3a85a0bae3aa3 Mon Sep 17 00:00:00 2001 From: Juan Quintela Date: Thu, 4 Mar 2010 23:11:41 -0300 Subject: [PATCH 19/42] check pipe() return value RH-Author: Juan Quintela Message-id: <8e4aea3f9217dc7e853bcebf896ffe752199df80.1267743950.git.quintela@redhat.com> Patchwork-id: 7549 O-Subject: [PATCH 19/32] check pipe() return value Bugzilla: 567099 RH-Acked-by: Kevin Wolf RH-Acked-by: Amit Shah RH-Acked-by: Marcelo Tosatti Signed-off-by: Juan Quintela Signed-off-by: Anthony Liguori (cherry picked from commit acdc3f0c59d076099c63425158c4811aaee984b6) Signed-off-by: Juan Quintela --- hw/xen_domainbuild.c | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) Signed-off-by: Eduardo Habkost --- hw/xen_domainbuild.c | 13 +++++++++---- 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); -- 1.6.3.rc4.29.g8146