diff --git a/stud.c b/stud.c index b623e83..18529e5 100644 --- a/stud.c +++ b/stud.c @@ -1642,12 +1642,6 @@ int main(int argc, char **argv) { /* load certificate, pass to handle_connections */ ssl_ctx = init_openssl(); - if (CONFIG->CHROOT && CONFIG->CHROOT[0]) - change_root(); - - if (CONFIG->UID || CONFIG->GID) - drop_privileges(); - /* should we daemonize ?*/ if (CONFIG->DAEMONIZE) { /* disable logging to stderr */ @@ -1658,6 +1652,12 @@ int main(int argc, char **argv) { daemonize(); } + if (CONFIG->CHROOT && CONFIG->CHROOT[0]) + change_root(); + + if (CONFIG->UID || CONFIG->GID) + drop_privileges(); + master_pid = getpid(); start_children(0, CONFIG->NCORES);