On 18/10/2011 11:35, Aharon Robbins wrote:
Here's a fix:
diff --git a/builtin.c b/builtin.c
index 072fd8f..bae02f4 100644
--- a/builtin.c
+++ b/builtin.c
@@ -1673,6 +1673,8 @@ do_strftime(int nargs)
if (do_lint&& (t2->flags& (NUMCUR|NUMBER)) == 0)
lintwarn(_("strftime: received non-numeric second argument"));
fclock = (time_t) force_number(t2);
+ if (fclock< 0)
+ fatal(_("strftime: second argument less than 0 or too big for
time_t"));
DEREF(t2);
}
Thanks. I am not sure if this is intended: before the fix, the behaviour
for (reasonable) negative values was:
$ echo -1 | TZ=UTC gawk '{print strftime("%Y-%m-%d",$1)}'
1969-12-31
$ echo -9999999999 | TZ=UTC gawk '{print strftime("%Y-%m-%d",$1)}'
1653-02-10
...and now it is:
$ echo -1 | TZ=UTC ./gawk '{print strftime("%Y-%m-%d",$1)}'
gawk: cmd. line:1: (FILENAME=- FNR=1) fatal: strftime: second argument
less than 0 or too big for time_t
Hermann