diff options
author | lns <matzeton@googlemail.com> | 2018-04-25 12:41:03 +0200 |
---|---|---|
committer | lns <matzeton@googlemail.com> | 2018-04-25 12:41:03 +0200 |
commit | d05358d2667d5b55a1bec36d051d95c06a3c7536 (patch) | |
tree | 11e9ef6d9cf9ecf12988151545c094397a6989ec /src/jail.c | |
parent | 03e137c2193d550dda156f86ca68c896f0dffe84 (diff) |
POTD skeleton #29.
Signed-off-by: lns <matzeton@googlemail.com>
Diffstat (limited to 'src/jail.c')
-rw-r--r-- | src/jail.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -231,10 +231,11 @@ static int jail_accept_client(jail_ctx *ctx[], args->client_psock.fd); args->prisoner_pid = clone(jail_childfn, ctx[i]->stack_beg, - SIGCHLD|clone_flags, NULL); + SIGCHLD|clone_flags, args); rc = 1; error: + socket_close(&args->client_psock); free(args); return rc; } @@ -245,13 +246,16 @@ error: static int jail_childfn(void *arg) { - (void) arg; + jail_prisoner_process *args; + + assert(arg); + args = (jail_prisoner_process *) arg; if (prctl(PR_SET_PDEATHSIG, SIGKILL) != 0) { E_STRERR("Jail child prctl"); exit(EXIT_FAILURE); } - printf("----> CHILD FN <----\n"); + printf("----> CHILD FN: %d <----\n", args->client_psock.fd); sleep(10); exit(EXIT_SUCCESS); |