Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: segfault in strftime



Vincent Lefevre wrote:
> Wouldn't it be better to test only errno != 0 ?

Well, given we're setting it to 0 beforehand that seems reasonable.

Index: Src/Modules/datetime.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/datetime.c,v
retrieving revision 1.20
diff -p -u -r1.20 datetime.c
--- Src/Modules/datetime.c	26 Feb 2010 15:30:45 -0000	1.20
+++ Src/Modules/datetime.c	26 Feb 2010 16:44:08 -0000
@@ -113,7 +113,7 @@ bin_strftime(char *nam, char **argv, Opt
 
     errno = 0;
     secs = (time_t)strtoul(argv[1], &endptr, 10);
-    if (secs == (time_t)ULONG_MAX && errno != 0) {
+    if (errno != 0) {
 	zwarnnam(nam, "%s: %e", argv[1], errno);
 	return 1;
     } else if (*endptr != '\0') {


-- 
Peter Stephenson <pws@xxxxxxx>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom



Messages sorted by: Reverse Date, Date, Thread, Author