diff options
author | Axel Beckert <abe@deuxchevaux.org> | 2015-11-26 21:14:04 +0100 |
---|---|---|
committer | Axel Beckert <abe@deuxchevaux.org> | 2015-11-26 21:14:04 +0100 |
commit | d62e937278a04b2cc8d4dde8be9562b9f10b068c (patch) | |
tree | 9ed62f2ee69f3231b0da25c69b420f3830f0fb3f /Src/utils.c | |
parent | e439a99f592f80729d28f5b2f6f3fbb012a3fd9d (diff) | |
parent | 78abc72f64b03d675922f9a958fdf5d6aa32ab67 (diff) | |
download | zsh-d62e937278a04b2cc8d4dde8be9562b9f10b068c.tar.gz zsh-d62e937278a04b2cc8d4dde8be9562b9f10b068c.zip |
Merge tag '5.1.1-test-2' into debian
Second test version prior to 5.2 release.
Diffstat (limited to 'Src/utils.c')
-rw-r--r-- | Src/utils.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/Src/utils.c b/Src/utils.c index 0afa8c908..464097034 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -3143,6 +3143,7 @@ strftimehandling: * in the accounting in bufsize (but nowhere else). */ { + char origchar = fmt[-1]; int size = fmt - fmtstart; char *tmp, *last; tmp = zhalloc(size + 1); @@ -3163,11 +3164,17 @@ strftimehandling: *buf = '\1'; if (!strftime(buf, bufsize + 2, tmp, tm)) { - if (*buf) { - buf[0] = '\0'; - return -1; + /* + * Some locales don't have strings for + * AM/PM, so empty output is valid. + */ + if (*buf || (origchar != 'p' && origchar != 'P')) { + if (*buf) { + buf[0] = '\0'; + return -1; + } + return 0; } - return 0; } decr = strlen(buf); buf += decr; |