From e437b2804344d6a888fd3ec90ffbf40a04f32307 Mon Sep 17 00:00:00 2001 From: pjd Date: Tue, 10 Jan 2012 22:41:09 +0000 Subject: - Fix a bug where pidfile was removed in SIGHUP when it hasn't changed in configuration file. - Log the fact that pidfile has changed. MFC after: 3 days --- sbin/hastd/hastd.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'sbin/hastd') diff --git a/sbin/hastd/hastd.c b/sbin/hastd/hastd.c index b4b3c59..945f4dc 100644 --- a/sbin/hastd/hastd.c +++ b/sbin/hastd/hastd.c @@ -573,10 +573,14 @@ hastd_reload(void) /* * Switch to new pidfile. */ - (void)pidfile_remove(pfh); - pfh = newpfh; - (void)strlcpy(cfg->hc_pidfile, newcfg->hc_pidfile, - sizeof(cfg->hc_pidfile)); + if (newpfh != NULL) { + pjdlog_info("Pidfile changed from %s to %s.", cfg->hc_pidfile, + newcfg->hc_pidfile); + (void)pidfile_remove(pfh); + pfh = newpfh; + (void)strlcpy(cfg->hc_pidfile, newcfg->hc_pidfile, + sizeof(cfg->hc_pidfile)); + } /* * Switch to new listen addresses. Close all that were removed. */ -- cgit v1.1