From: gerhard Date: Wed, 28 Jun 2023 12:31:19 +0000 (+0000) Subject: Don't call daemon() after proc_init(), otherwise the child processes X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=1fee06b04ef0d983e86b8eef050f0ca7489fc530;p=openbsd Don't call daemon() after proc_init(), otherwise the child processes would lose their parent. ok tobhe@ --- diff --git a/sbin/iked/iked.c b/sbin/iked/iked.c index 7af05d9a607..66268a9cad6 100644 --- a/sbin/iked/iked.c +++ b/sbin/iked/iked.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iked.c,v 1.65 2023/06/25 08:07:04 op Exp $ */ +/* $OpenBSD: iked.c,v 1.66 2023/06/28 12:31:19 gerhard Exp $ */ /* * Copyright (c) 2019 Tobias Heider @@ -203,8 +203,6 @@ main(int argc, char *argv[]) setproctitle("parent"); log_procinit("parent"); - if (!debug && daemon(0, 0) == -1) - err(1, "failed to daemonize"); event_init(); diff --git a/sbin/iked/proc.c b/sbin/iked/proc.c index 87a80674856..6ade7315f4e 100644 --- a/sbin/iked/proc.c +++ b/sbin/iked/proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.c,v 1.38 2023/03/05 22:17:22 tobhe Exp $ */ +/* $OpenBSD: proc.c,v 1.39 2023/06/28 12:31:19 gerhard Exp $ */ /* * Copyright (c) 2010 - 2016 Reyk Floeter @@ -205,6 +205,8 @@ proc_init(struct privsep *ps, struct privsep_proc *procs, unsigned int nproc, if (proc_id == PROC_PARENT) { privsep_process = PROC_PARENT; + if (!debug && daemon(0, 0) == -1) + fatal("failed to daemonize"); proc_setup(ps, procs, nproc); /*