summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/chpass/chpass.c12
-rw-r--r--usr.bin/chpass/util.c10
2 files changed, 11 insertions, 11 deletions
diff --git a/usr.bin/chpass/chpass.c b/usr.bin/chpass/chpass.c
index d77736dedde..f849ff892c3 100644
--- a/usr.bin/chpass/chpass.c
+++ b/usr.bin/chpass/chpass.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: chpass.c,v 1.34 2007/03/27 07:22:33 jmc Exp $ */
+/* $OpenBSD: chpass.c,v 1.35 2008/06/19 19:16:04 tobias Exp $ */
/* $NetBSD: chpass.c,v 1.8 1996/05/15 21:50:43 jtc Exp $ */
/*-
@@ -40,7 +40,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)chpass.c 8.4 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: chpass.c,v 1.34 2007/03/27 07:22:33 jmc Exp $";
+static char rcsid[] = "$OpenBSD: chpass.c,v 1.35 2008/06/19 19:16:04 tobias Exp $";
#endif
#endif /* not lint */
@@ -82,12 +82,18 @@ main(int argc, char *argv[])
{
struct passwd *pw = NULL, *opw = NULL, lpw;
int i, ch, pfd, tfd, dfd;
- char *arg = NULL;
+ char *tz, *arg = NULL;
sigset_t fullset;
#ifdef YP
use_yp = _yp_check(NULL);
#endif
+ /* We need to use the system timezone for date conversions. */
+ if ((tz = getenv("TZ")) != NULL) {
+ unsetenv("TZ");
+ tzset();
+ setenv("TZ", tz, 1);
+ }
op = EDITENTRY;
while ((ch = getopt(argc, argv, "a:s:ly")) != -1)
diff --git a/usr.bin/chpass/util.c b/usr.bin/chpass/util.c
index 3ab8c7c3a7a..6328a3fb8df 100644
--- a/usr.bin/chpass/util.c
+++ b/usr.bin/chpass/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.7 2003/07/01 01:01:28 avsm Exp $ */
+/* $OpenBSD: util.c,v 1.8 2008/06/19 19:16:04 tobias Exp $ */
/* $NetBSD: util.c,v 1.4 1995/03/26 04:55:35 glass Exp $ */
/*-
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)util.c 8.4 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: util.c,v 1.7 2003/07/01 01:01:28 avsm Exp $";
+static char rcsid[] = "$OpenBSD: util.c,v 1.8 2008/06/19 19:16:04 tobias Exp $";
#endif
#endif /* not lint */
@@ -67,7 +67,6 @@ ttoa(char *buf, size_t len, time_t tval)
int
atot(char *p, time_t *store)
{
- static struct tm *lt;
struct tm tm;
time_t tval;
char *t;
@@ -76,11 +75,6 @@ atot(char *p, time_t *store)
*store = 0;
return (0);
}
- if (!lt) {
- unsetenv("TZ");
- (void)time(&tval);
- lt = localtime(&tval);
- }
(void) memset(&tm, 0, sizeof(tm));
for (t = p; (t = strchr(t, ',')) != NULL; t++)
*t = ' ';