Fix a warning and a bug: pipe(2) can fail
authorVolker Lendecke <vl@samba.org>
Sat, 14 Feb 2009 16:38:05 +0000 (17:38 +0100)
committerVolker Lendecke <vl@samba.org>
Sat, 14 Feb 2009 21:00:44 +0000 (22:00 +0100)
lib/tevent/tevent_signal.c

index b87c212402b67d8dabc60af29e4fc0d03849a158..f71d9b36b0e365431f11215fc90ba3892c29c25f 100644 (file)
@@ -255,7 +255,10 @@ struct tevent_signal *tevent_common_add_signal(struct tevent_context *ev,
        if (ev->pipe_fde == NULL) {
                if (sig_state->pipe_hack[0] == 0 && 
                    sig_state->pipe_hack[1] == 0) {
-                       pipe(sig_state->pipe_hack);
+                       if (pipe(sig_state->pipe_hack) == -1) {
+                               talloc_free(se);
+                               return NULL;
+                       }
                        ev_set_blocking(sig_state->pipe_hack[0], false);
                        ev_set_blocking(sig_state->pipe_hack[1], false);
                }