1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-02 10:01:11 +02:00

users/14900: ULONG_MAX is a valid return value from strotoul()

This commit is contained in:
Peter Stephenson 2010-02-26 15:30:37 +00:00
parent e8c1e2ff4c
commit d5a0f7623c
2 changed files with 6 additions and 2 deletions

View file

@ -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 $
*****************************************************

View file

@ -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') {