Skip to content

Commit 44b6ba3

Browse files
bachradsusiWOnder93
authored andcommitted
userns_child_exec: Propagate child exit value
Sometimes it's useful to know how a child ended. Signed-off-by: Petr Lautrbach <[email protected]>
1 parent 122484a commit 44b6ba3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/cap_userns/userns_child_exec.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ static char child_stack[STACK_SIZE]; /* Space for child's stack */
198198
int
199199
main(int argc, char *argv[])
200200
{
201-
int flags, opt, map_zero, test_clone = 0;
201+
int flags, opt, map_zero, test_clone = 0, wstatus;
202202
pid_t child_pid;
203203
struct child_args args;
204204
char *uid_map, *gid_map;
@@ -332,11 +332,11 @@ main(int argc, char *argv[])
332332

333333
close(args.pipe_fd[1]);
334334

335-
if (waitpid(child_pid, NULL, 0) == -1) /* Wait for child */
335+
if (waitpid(child_pid, &wstatus, 0) == -1) /* Wait for child */
336336
errExit("waitpid");
337337

338338
if (verbose)
339339
printf("%s: terminating\n", argv[0]);
340340

341-
exit(EXIT_SUCCESS);
341+
exit(WEXITSTATUS(wstatus));
342342
}

0 commit comments

Comments
 (0)