1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-20 02:30:23 +02:00

Use Gnulib's `strftime' to address bug #24130.

* libguile/stime.c (scm_strftime): Use `nstrftime ()' from Gnulib.
  This provides the same semantics on all platforms, thereby fixing
  bug #24130.

* doc/ref/posix.texi (Time): Remove note about non-portable `%Z'
  behavior.  Describe the new, portable behavior.

* test-suite/tests/time.test ("strftime")["strftime %Z doesn't return
  garbage"]: Reinstate.
  ["C99 %z format"](have-strftime-%z): Remove.
  ("GMT", "EST+5"): Don't use `have-strftime-%z'.
This commit is contained in:
Ludovic Courtès 2008-09-02 21:24:53 +02:00
parent e65fc94b7a
commit 69f23174d3
3 changed files with 14 additions and 59 deletions

View file

@ -44,6 +44,7 @@
#include <stdio.h>
#include <errno.h>
#include <strftime.h>
#include "libguile/_scm.h"
#include "libguile/async.h"
@ -689,10 +690,9 @@ SCM_DEFINE (scm_strftime, "strftime", 2, 0, 0,
tzset ();
#endif
/* POSIX says strftime returns 0 on buffer overrun, but old
systems (i.e. libc 4 on GNU/Linux) might return `size' in that
case. */
while ((len = strftime (tbuf, size, myfmt, &t)) == 0 || len == size)
/* Use `nstrftime ()' from Gnulib, which supports all GNU extensions
supported by glibc. */
while ((len = nstrftime (tbuf, size, myfmt, &t, 0, 0)) == 0)
{
free (tbuf);
size *= 2;