about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2010-02-26 14:24:57 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2010-02-26 14:24:57 +0000
commite8c1e2ff4ca3db7f03413958fd56b5d0783714c7 (patch)
tree51347c26d10424192371a5f15468a669b52797fa
parent07b6256d8ea03805dd8a24c184bf455ee31d6115 (diff)
downloadzsh-e8c1e2ff4ca3db7f03413958fd56b5d0783714c7.tar.gz
zsh-e8c1e2ff4ca3db7f03413958fd56b5d0783714c7.tar.xz
zsh-e8c1e2ff4ca3db7f03413958fd56b5d0783714c7.zip
users/14897: extra test in strftime builtin for time conversion
-rw-r--r--ChangeLog5
-rw-r--r--Src/Modules/datetime.c4
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 268e5b202..73300e602 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2010-02-26  Peter Stephenson  <pws@csr.com>
 
+	* users/14897: Src/Modules/datetime.c: test needed on
+	conversion of time_t to struct tm.  Found on 64-bit Linux.
+
 	* 27756: Doc/Zsh/calsys.yo, Functions/Calendar/calendar,
 	Functions/Calendar/calendar_add, Functions/Calendar/calendar_edit,
 	Functions/Calendar/calendar_sort, Src/Modules/system.c:
@@ -12835,5 +12838,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.4917 $
+* $Revision: 1.4918 $
 *****************************************************
diff --git a/Src/Modules/datetime.c b/Src/Modules/datetime.c
index 328870eba..f1c5488ea 100644
--- a/Src/Modules/datetime.c
+++ b/Src/Modules/datetime.c
@@ -121,6 +121,10 @@ bin_strftime(char *nam, char **argv, Options ops, UNUSED(int func))
     }
 
     t = localtime(&secs);
+    if (!t) {
+	zwarnnam(nam, "%s: unable to convert to time", argv[1]);
+	return 1;
+    }
     bufsize = strlen(argv[0]) * 8;
     buffer = zalloc(bufsize);