mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-09 10:01:16 +02:00
* 19869: Src/prompt.c, Src/utils.c: avoid segfault when
prompt-expanding '%D{%p}' or '%D{%P}' under locales with null strings for am_pm.
This commit is contained in:
parent
885509c023
commit
c98b9dc800
3 changed files with 11 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2004-05-04 Clint Adams <clint@zsh.org>
|
||||||
|
|
||||||
|
* 19869: Src/prompt.c, Src/utils.c: avoid segfault when
|
||||||
|
prompt-expanding '%D{%p}' or '%D{%P}' under locales with null
|
||||||
|
strings for am_pm.
|
||||||
|
|
||||||
2004-05-02 Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
|
2004-05-02 Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
|
||||||
|
|
||||||
* 19858: Doc/Zsh/options.yo, Src/jobs.c, Src/options.c,
|
* 19858: Doc/Zsh/options.yo, Src/jobs.c, Src/options.c,
|
||||||
|
|
|
@ -528,7 +528,9 @@ putpromptchar(int doprint, int endchar)
|
||||||
tm = localtime(&timet);
|
tm = localtime(&timet);
|
||||||
for(t0=80; ; t0*=2) {
|
for(t0=80; ; t0*=2) {
|
||||||
addbufspc(t0);
|
addbufspc(t0);
|
||||||
if (ztrftime(bp, t0, tmfmt, tm))
|
if (ztrftime(bp, t0, tmfmt, tm) ||
|
||||||
|
!strcmp("%P", tmfmt) ||
|
||||||
|
!strcmp("%p", tmfmt))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
bp += strlen(bp);
|
bp += strlen(bp);
|
||||||
|
|
|
@ -1831,7 +1831,8 @@ ztrftime(char *buf, int bufsize, char *fmt, struct tm *tm)
|
||||||
*/
|
*/
|
||||||
*buf = '\0';
|
*buf = '\0';
|
||||||
tmp[1] = fmt[-1];
|
tmp[1] = fmt[-1];
|
||||||
if (!strftime(buf, bufsize + 2, tmp, tm))
|
if (!strftime(buf, bufsize + 2, tmp, tm) &&
|
||||||
|
tmp[1]!='p' && tmp[1]!='P')
|
||||||
return 0;
|
return 0;
|
||||||
decr = strlen(buf);
|
decr = strlen(buf);
|
||||||
buf += decr;
|
buf += decr;
|
||||||
|
|
Loading…
Reference in a new issue