changeset 372:fb674793e75a HEAD

kludge: localtime() must be called before chroot(), or the timezone isn't known. fixes wrong timestamps with login process.
author Timo Sirainen <tss@iki.fi>
date Sun, 06 Oct 2002 14:03:24 +0300
parents 3ac9badb73ba
children 5d2298649157
files src/lib/restrict-access.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/restrict-access.c	Sun Oct 06 13:47:12 2002 +0300
+++ b/src/lib/restrict-access.c	Sun Oct 06 14:03:24 2002 +0300
@@ -26,6 +26,7 @@
 
 #include <stdlib.h>
 #include <unistd.h>
+#include <time.h>
 #include <grp.h>
 
 void restrict_access_set_env(const char *user, uid_t uid, gid_t gid,
@@ -49,6 +50,11 @@
 	/* chrooting */
 	env = getenv("CHROOT");
 	if (env != NULL) {
+		/* kludge: localtime() must be called before chroot(),
+		   or the timezone isn't known */
+		time_t t = 0;
+		(void)localtime(&t);
+
 		if (chroot(env) != 0)
 			i_fatal("chroot(%s) failed: %m", env);