about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2010-02-26 15:30:37 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2010-02-26 15:30:37 +0000
commitd5a0f7623c2b1a5c83a9602cb2f881317d2771e2 (patch)
tree7486f70f0bbb7a45fba81d95e8d81548ac1b729b
parente8c1e2ff4ca3db7f03413958fd56b5d0783714c7 (diff)
downloadzsh-d5a0f7623c2b1a5c83a9602cb2f881317d2771e2.tar.gz
zsh-d5a0f7623c2b1a5c83a9602cb2f881317d2771e2.tar.xz
zsh-d5a0f7623c2b1a5c83a9602cb2f881317d2771e2.zip
users/14900: ULONG_MAX is a valid return value from strotoul()
-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') {