mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-27 04:40:59 +01:00
40681: strftime builtin should return 1 if ztrftime() returns -1
This commit is contained in:
parent
47c05f6b66
commit
0697c45ab3
2 changed files with 11 additions and 2 deletions
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue