The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=7bad3c3e5f1c8b4d9e620bb2943299d4a30f3c86
commit 7bad3c3e5f1c8b4d9e620bb2943299d4a30f3c86 Author: John Baldwin <j...@freebsd.org> AuthorDate: 2025-02-05 19:53:14 +0000 Commit: John Baldwin <j...@freebsd.org> CommitDate: 2025-02-05 19:55:16 +0000 ctld: Write the pidfile once after forking Don't rewrite the pidfile each time main_loop is called. PR: 284282 Reported by: asomers Reviewed by: asomers Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D48768 --- usr.sbin/ctld/ctld.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usr.sbin/ctld/ctld.c b/usr.sbin/ctld/ctld.c index 06307d6cdd9a..3b48d33b5966 100644 --- a/usr.sbin/ctld/ctld.c +++ b/usr.sbin/ctld/ctld.c @@ -2381,7 +2381,7 @@ handle_connection(struct portal *portal, int fd, } static void -main_loop(struct conf *conf, bool dont_fork) +main_loop(bool dont_fork) { struct kevent kev; struct portal *portal; @@ -2393,8 +2393,6 @@ main_loop(struct conf *conf, bool dont_fork) #endif int error, client_fd; - pidfile_write(conf->conf_pidfh); - for (;;) { if (sighup_received || sigterm_received || timed_out()) return; @@ -2762,12 +2760,14 @@ main(int argc, char **argv) conf_delete(oldconf); oldconf = NULL; + pidfile_write(newconf->conf_pidfh); + /* Schedule iSNS update */ if (!TAILQ_EMPTY(&newconf->conf_isns)) set_timeout((newconf->conf_isns_period + 2) / 3, false); for (;;) { - main_loop(newconf, dont_daemonize); + main_loop(dont_daemonize); if (sighup_received) { sighup_received = false; log_debugx("received SIGHUP, reloading configuration");