The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=f1c08b6111246ed390319d3655a0d20a4e999c71
commit f1c08b6111246ed390319d3655a0d20a4e999c71 Author: John Baldwin <[email protected]> AuthorDate: 2025-02-05 19:53:14 +0000 Commit: John Baldwin <[email protected]> CommitDate: 2026-01-27 18:15:56 +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 (cherry picked from commit 7bad3c3e5f1c8b4d9e620bb2943299d4a30f3c86) --- 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 b327fb8f003b..6729331569c5 100644 --- a/usr.sbin/ctld/ctld.c +++ b/usr.sbin/ctld/ctld.c @@ -2382,7 +2382,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; @@ -2394,8 +2394,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; @@ -2763,12 +2761,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");
