aboutsummaryrefslogtreecommitdiff
path: root/src/jail.c
diff options
context:
space:
mode:
authorlns <matzeton@googlemail.com>2018-04-25 12:41:03 +0200
committerlns <matzeton@googlemail.com>2018-04-25 12:41:03 +0200
commitd05358d2667d5b55a1bec36d051d95c06a3c7536 (patch)
tree11e9ef6d9cf9ecf12988151545c094397a6989ec /src/jail.c
parent03e137c2193d550dda156f86ca68c896f0dffe84 (diff)
POTD skeleton #29.
Signed-off-by: lns <matzeton@googlemail.com>
Diffstat (limited to 'src/jail.c')
-rw-r--r--src/jail.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/jail.c b/src/jail.c
index aa57581..22c8ec2 100644
--- a/src/jail.c
+++ b/src/jail.c
@@ -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);