Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

Call daemonize before chroot. #118

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions stud.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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);
Expand Down