Patchwork [v4,1/3] qxl: init_pipe_signaling: exit on failure

login
register
mail settings
Submitter Alon Levy
Date March 18, 2012, 12:46 p.m.
Message ID <1332074775-31270-2-git-send-email-alevy@redhat.com>
Download mbox | patch
Permalink /patch/147376/
State New
Headers show

Comments

Alon Levy - March 18, 2012, 12:46 p.m.
If pipe creation fails, exit, don't log and continue. Fix indentation at
the same time.

Signed-off-by: Alon Levy <alevy@redhat.com>
---
 hw/qxl.c |   21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

Patch

diff --git a/hw/qxl.c b/hw/qxl.c
index e17b0e3..26ca893 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -1452,16 +1452,17 @@  static void qxl_send_events(PCIQXLDevice *d, uint32_t events)
 
 static void init_pipe_signaling(PCIQXLDevice *d)
 {
-   if (pipe(d->pipe) < 0) {
-       dprint(d, 1, "%s: pipe creation failed\n", __FUNCTION__);
-       return;
-   }
-   fcntl(d->pipe[0], F_SETFL, O_NONBLOCK);
-   fcntl(d->pipe[1], F_SETFL, O_NONBLOCK);
-   fcntl(d->pipe[0], F_SETOWN, getpid());
-
-   qemu_thread_get_self(&d->main);
-   qemu_set_fd_handler(d->pipe[0], pipe_read, NULL, d);
+    if (pipe(d->pipe) < 0) {
+        fprintf(stderr, "%s:%s: qxl pipe creation failed\n",
+                __FILE__, __func__);
+        exit(1);
+    }
+    fcntl(d->pipe[0], F_SETFL, O_NONBLOCK);
+    fcntl(d->pipe[1], F_SETFL, O_NONBLOCK);
+    fcntl(d->pipe[0], F_SETOWN, getpid());
+
+    qemu_thread_get_self(&d->main);
+    qemu_set_fd_handler(d->pipe[0], pipe_read, NULL, d);
 }
 
 /* graphics console */