syslogd: re-read the timezone when receive a SIGHUP.

syslogd already re-reads the configuration file and the hostname when
receiving a SIGHUP, so it makes sense to reset the timezone.
Special care was taken to ensure we don't break installations running
with a custom TZ variable.

PR:		196905
Submitted by:	Kurt Lidl <lidl pix.net>
Sponsored by:	Pi-Coral, Inc.
This commit is contained in:
Rui Paulo 2015-06-16 22:42:19 +00:00
parent e87161769c
commit baa557331e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=284476

View File

@ -1602,6 +1602,24 @@ init(int signo)
LocalDomain = "";
}
/*
* Load / reload timezone data (in case it changed).
*
* Just calling tzset() again does not work, the timezone code
* caches the result. However, by setting the TZ variable, one
* can defeat the caching and have the timezone code really
* reload the timezone data. Respect any initial setting of
* TZ, in case the system is configured specially.
*/
dprintf("loading timezone data via tzset()\n");
if (getenv("TZ")) {
tzset();
} else {
setenv("TZ", ":/etc/localtime", 1);
tzset();
unsetenv("TZ");
}
/*
* Close all open log files.
*/