Mercurial > emacs
changeset 19032:84ae0a03a643
(Fformat_time_string): Don't hang if strftime produces
an empty string. Fix arguments of second call to strftime.
Remove check for result being negative, this cannot happen.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 29 Jul 1997 02:29:32 +0000 |
parents | 369a8580b08e |
children | b1e77e91eaae |
files | src/editfns.c |
diffstat | 1 files changed, 3 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/editfns.c Tue Jul 29 02:15:28 1997 +0000 +++ b/src/editfns.c Tue Jul 29 02:29:32 1997 +0000 @@ -874,16 +874,15 @@ char *buf = (char *) alloca (size + 1); int result; + buf[0] = '\1'; result = emacs_strftime (buf, size, XSTRING (format_string)->data, (NILP (universal) ? localtime (&value) : gmtime (&value))); - if (result > 0 && result < size) + if ((result > 0 && result < size) || (result == 0 && buf[0] == '\0')) return build_string (buf); - if (result < 0) - error ("Invalid time format specification"); /* If buffer was too small, make it bigger and try again. */ - result = emacs_strftime (buf, 0, XSTRING (format_string)->data, + result = emacs_strftime (NULL, 0x7fffffff, XSTRING (format_string)->data, (NILP (universal) ? localtime (&value) : gmtime (&value))); size = result + 1;