about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/Modules/datetime.c3
2 files changed, 6 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 73300e602..22c72b03a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2010-02-26  Peter Stephenson  <pws@csr.com>
 
+	* users/14900 Src/Moduels/datetime.c: ULONG_MAX may be valid
+	return value from strtoul().
+
 	* users/14897: Src/Modules/datetime.c: test needed on
 	conversion of time_t to struct tm.  Found on 64-bit Linux.
 
@@ -12838,5 +12841,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.4918 $
+* $Revision: 1.4919 $
 *****************************************************
diff --git a/Src/Modules/datetime.c b/Src/Modules/datetime.c
index f1c5488ea..2f69ecae6 100644
--- a/Src/Modules/datetime.c
+++ b/Src/Modules/datetime.c
@@ -111,8 +111,9 @@ bin_strftime(char *nam, char **argv, Options ops, UNUSED(int func))
     if (OPT_ISSET(ops, 'r'))
 	return reverse_strftime(nam, argv, scalar, OPT_ISSET(ops, 'q'));
 
+    errno = 0;
     secs = (time_t)strtoul(argv[1], &endptr, 10);
-    if (secs == (time_t)ULONG_MAX) {
+    if (secs == (time_t)ULONG_MAX && errno != 0) {
 	zwarnnam(nam, "%s: %e", argv[1], errno);
 	return 1;
     } else if (*endptr != '\0') {