commit dbc85498aa04f27ae3e011e0a75f8a73173970e616145f32b49967edbd36fc9d from: Stefan Sperling date: Thu Oct 29 15:24:41 2026 UTC move privdrop out of the per-process switch statement in gotd's main() function This might make it easier for -portable to fix the chroot issue mentioned in https://marc.gameoftrees.org/mail/1743195001.95133_0.html The parent process would need to keep running as root, to allow children to start up as root and use chroot() before privdrop. commit - 6c1c3b032c05ecdacbe8627c13135075cd8020aa677cc2f79730596952928608 commit + dbc85498aa04f27ae3e011e0a75f8a73173970e616145f32b49967edbd36fc9d blob - b0146695670294f8323c0ffa3e135511a93b92baee7d262c2f9b8fc826b5991e blob + 076d8e86df5920ab384391611394ae572369e42b49972017329931b1d361f6e2 --- gotd/gotd.c +++ gotd/gotd.c @@ -3746,16 +3746,19 @@ main(int argc, char **argv) event_init(); - switch (proc_id) { - case GOTD_PROC_GOTD: + if (proc_id == GOTD_PROC_RELOAD) + proc_id = GOTD_PROC_GOTD; + + if (proc_id == GOTD_PROC_GOTD) { /* Drop root privileges. */ if (setgid(pw->pw_gid) == -1) fatal("setgid %d failed", pw->pw_gid); if (setuid(pw->pw_uid) == -1) fatal("setuid %d failed", pw->pw_uid); - /* FALLTHROUGH */ - case GOTD_PROC_RELOAD: - proc_id = GOTD_PROC_GOTD; + } + + switch (proc_id) { + case GOTD_PROC_GOTD: if (verbosity) { log_info("socket: %s", gotd.unix_socket_path); log_info("user: %s", pw->pw_name);