summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bubblewrap.c7
-rw-r--r--utils.h2
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)
diff --git a/utils.h b/utils.h
index e4d5dff..039546f 100644
--- a/utils.h
+++ b/utils.h
@@ -37,6 +37,8 @@
#define __debug__(x)
#endif
+#define UNUSED __attribute__((__unused__))
+
#define N_ELEMENTS(arr) (sizeof (arr) / sizeof ((arr)[0]))
#define TRUE 1