diff options
author | lns <matzeton@googlemail.com> | 2018-04-25 08:50:29 +0200 |
---|---|---|
committer | lns <matzeton@googlemail.com> | 2018-04-25 08:50:29 +0200 |
commit | 03e137c2193d550dda156f86ca68c896f0dffe84 (patch) | |
tree | dfb4e7445a8eda1e5b9c606083536825c90b8145 /src/jail.c | |
parent | 6e7b5102c33a510f93b7b418d0bfc082ae2595f7 (diff) |
POTD skeleton #28.
Diffstat (limited to 'src/jail.c')
-rw-r--r-- | src/jail.c | 29 |
1 files changed, 15 insertions, 14 deletions
@@ -115,8 +115,9 @@ int jail_setup_epoll(jail_ctx *ctx[], size_t siz) return fd; } -int jail_daemonize_epoll(int epoll_fd, jail_ctx *ctx[], size_t siz) +pid_t jail_daemonize_epoll(int epoll_fd, jail_ctx *ctx[], size_t siz) { + pid_t p; int s; size_t i; @@ -130,21 +131,21 @@ int jail_daemonize_epoll(int epoll_fd, jail_ctx *ctx[], size_t siz) E_GAIERR(s, "Could not initialise jail daemon socket"); return 1; } + } - ctx[i]->jail_pid = fork(); - switch (ctx[i]->jail_pid) { - case -1: - W_STRERR("Jail daemonize"); - return 1; - case 0: - N("%s", "Jail daemon mainloop"); - jail_daemonfn_epoll(epoll_fd, ctx, siz); - break; - } - D2("Jail daemon pid: %d", ctx[i]->jail_pid); - } + p = fork(); + switch (p) { + case -1: + W_STRERR("Jail daemonize"); + return -1; + case 0: + N("%s", "Jail daemon mainloop"); + jail_daemonfn_epoll(epoll_fd, ctx, siz); + break; + } + D2("Jail daemon pid: %d", p); - return 0; + return p; } static int jail_daemonfn_epoll(int epoll_fd, jail_ctx *ctx[], size_t siz) |