diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2011-10-28 14:08:59 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2011-10-28 14:08:59 +0200 |
commit | 8daacca02f8ae18ff1e2cdd38fbc01985b045432 (patch) | |
tree | cea796234d5d9772aedb2b637fa47e319f4d38b3 /builtin.c | |
parent | 77deb36f927d2185dc2e3c7c8906071d277543ec (diff) | |
download | egawk-8daacca02f8ae18ff1e2cdd38fbc01985b045432.tar.gz egawk-8daacca02f8ae18ff1e2cdd38fbc01985b045432.tar.bz2 egawk-8daacca02f8ae18ff1e2cdd38fbc01985b045432.zip |
Fix for strftime negative value test.
Diffstat (limited to 'builtin.c')
-rw-r--r-- | builtin.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1630,6 +1630,7 @@ do_strftime(int nargs) NODE *t1, *t2, *t3, *ret; struct tm *tm; time_t fclock; + long clock_val; char *bufp; size_t buflen, bufsize; char buf[BUFSIZ]; @@ -1676,9 +1677,10 @@ do_strftime(int nargs) t2 = POP_SCALAR(); if (do_lint && (t2->flags & (NUMCUR|NUMBER)) == 0) lintwarn(_("strftime: received non-numeric second argument")); - fclock = (time_t) force_number(t2); - if (((long int) fclock) < 0) + clock_val = (long) force_number(t2); + if (clock_val < 0) fatal(_("strftime: second argument less than 0 or too big for time_t")); + fclock = (time_t) clock_val; DEREF(t2); } |