diff options
author | Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp> | 2017-03-02 11:02:01 +0900 |
---|---|---|
committer | Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp> | 2017-03-02 11:09:12 +0900 |
commit | 0697c45ab38f60f9cb80e0c4be3d0eb23acb0d30 (patch) | |
tree | 3999b2504d02baf610d8de92be9efaa38ac3370e /Src/Modules | |
parent | 47c05f6b66ebd071a60a76158d7f51d4b49c25a2 (diff) | |
download | zsh-0697c45ab38f60f9cb80e0c4be3d0eb23acb0d30.tar.gz zsh-0697c45ab38f60f9cb80e0c4be3d0eb23acb0d30.tar.xz zsh-0697c45ab38f60f9cb80e0c4be3d0eb23acb0d30.zip |
40681: strftime builtin should return 1 if ztrftime() returns -1
Diffstat (limited to 'Src/Modules')
-rw-r--r-- | Src/Modules/datetime.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Src/Modules/datetime.c b/Src/Modules/datetime.c index bb82c542f..6e9047bc5 100644 --- a/Src/Modules/datetime.c +++ b/Src/Modules/datetime.c @@ -133,11 +133,15 @@ output_strftime(char *nam, char **argv, Options ops, UNUSED(int func)) len = 0; for (x=0; x < 4; x++) { - if ((len = ztrftime(buffer, bufsize, argv[0], t, 0L)) >= 0) + if ((len = ztrftime(buffer, bufsize, argv[0], t, 0L)) >= 0 || x==3) break; buffer = zrealloc(buffer, bufsize *= 2); } - DPUTS(len < 0, "bad output from ztrftime"); + if (len < 0) { + zwarnnam(nam, "bad/unsupported format: '%s'", argv[0]); + zfree(buffer, bufsize); + return 1; + } if (scalar) { setsparam(scalar, metafy(buffer, len, META_DUP)); |