Mercurial > pidgin
changeset 13115:e42983a1038c
[gaim-migrate @ 15477]
Error handling for strftime. Yay for not having to do this for every use of strftime in Gaim...
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Sat, 04 Feb 2006 00:02:41 +0000 |
parents | c73c7dd0721f |
children | 0651b6008120 |
files | src/util.c |
diffstat | 1 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/util.c Sat Feb 04 00:01:44 2006 +0000 +++ b/src/util.c Sat Feb 04 00:02:41 2006 +0000 @@ -490,7 +490,15 @@ static char buf[128]; char *utf8; - strftime(buf, sizeof(buf), format, tm); + /* A return value of 0 is either an error (in + * which case, the contents of the buffer are + * undefined) or the empty string (in which + * case, no harm is done here). */ + if (strftime(buf, sizeof(buf), format, tm) == 0) + { + buf = '\0'; + return buf; + } if ((utf8 = gaim_utf8_try_convert(buf))) {