Module Name: src
Committed By: christos
Date: Mon Dec 26 14:53:17 UTC 2016
Modified Files:
src/usr.bin/cvslatest: cvslatest.c
Log Message:
- use UTC
- initialize tm_isdst
- use accpath to handle relative paths
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/cvslatest/cvslatest.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/cvslatest/cvslatest.c
diff -u src/usr.bin/cvslatest/cvslatest.c:1.3 src/usr.bin/cvslatest/cvslatest.c:1.4
--- src/usr.bin/cvslatest/cvslatest.c:1.3 Sun Dec 18 20:48:00 2016
+++ src/usr.bin/cvslatest/cvslatest.c Mon Dec 26 09:53:17 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: cvslatest.c,v 1.3 2016/12/19 01:48:00 christos Exp $ */
+/* $NetBSD: cvslatest.c,v 1.4 2016/12/26 14:53:17 christos Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: cvslatest.c,v 1.3 2016/12/19 01:48:00 christos Exp $");
+__RCSID("$NetBSD: cvslatest.c,v 1.4 2016/12/26 14:53:17 christos Exp $");
/*
* Find the latest timestamp in a set of CVS trees, by examining the
@@ -113,6 +113,7 @@ getlatest(const char *path, const char *
if (!ignore)
exit(EXIT_FAILURE);
}
+ tm.tm_isdst = 0; // We are in GMT anyway
if ((t = mktime(&tm)) == (time_t)-1)
errx(EXIT_FAILURE, "Time conversion `%s' in `%s'",
dt, name);
@@ -152,8 +153,8 @@ cvsscan(char **pathv, const char *name,
if (strcmp(entry->fts_name, name) != 0)
continue;
- getrepo(entry->fts_path, repo, sizeof(repo));
- getlatest(entry->fts_path, repo, lat);
+ getrepo(entry->fts_accpath, repo, sizeof(repo));
+ getlatest(entry->fts_accpath, repo, lat);
}
(void)fts_close(dh);
@@ -192,6 +193,9 @@ main(int argc, char *argv[])
if (argc == optind)
usage();
+ // So that mktime behaves consistently
+ setenv("TZ", "UTC", 1);
+
cvsscan(argv + optind, name, &lat);
if (debug)
printlat(&lat);