svn commit: r284476 - head/usr.sbin/syslogd

Rui Paulo rpaulo at FreeBSD.org
Tue Jun 16 22:42:20 UTC 2015


Author: rpaulo
Date: Tue Jun 16 22:42:19 2015
New Revision: 284476
URL: https://svnweb.freebsd.org/changeset/base/284476

Log:
  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.

Modified:
  head/usr.sbin/syslogd/syslogd.c

Modified: head/usr.sbin/syslogd/syslogd.c
==============================================================================
--- head/usr.sbin/syslogd/syslogd.c	Tue Jun 16 22:31:38 2015	(r284475)
+++ head/usr.sbin/syslogd/syslogd.c	Tue Jun 16 22:42:19 2015	(r284476)
@@ -1603,6 +1603,24 @@ init(int signo)
 	}
 
 	/*
+	 * 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.
 	 */
 	Initialized = 0;


More information about the svn-src-head mailing list