diff options
-rw-r--r-- | bubblewrap.c | 7 | ||||
-rw-r--r-- | utils.h | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/bubblewrap.c b/bubblewrap.c index 8d36515..8adf5c6 100644 --- a/bubblewrap.c +++ b/bubblewrap.c @@ -315,15 +315,18 @@ do_init (int event_fd, pid_t initial_pid) int status; child = wait (&status); - if (child == initial_pid) + if (child == initial_pid && event_fd != -1) { uint64_t val; + int res UNUSED; if (WIFEXITED (status)) initial_exit_status = WEXITSTATUS(status); val = initial_exit_status + 1; - (void) write (event_fd, &val, 8); + res = write (event_fd, &val, 8); + /* Ignore res, if e.g. the parent died and closed event_fd + we don't want to error out here */ } if (child == -1 && errno != EINTR) @@ -37,6 +37,8 @@ #define __debug__(x) #endif +#define UNUSED __attribute__((__unused__)) + #define N_ELEMENTS(arr) (sizeof (arr) / sizeof ((arr)[0])) #define TRUE 1 |