Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Jun 2015 22:42:19 +0000 (UTC)
From:      Rui Paulo <rpaulo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r284476 - head/usr.sbin/syslogd
Message-ID:  <201506162242.t5GMgJk1049842@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201506162242.t5GMgJk1049842>