From: Paul Eggert Date: Mon, 14 Mar 2005 23:23:43 +0000 (+0000) Subject: * strftime.c (my_strftime) [HAVE_STRFTIME && ! (_NL_CURRENT X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a363a3b16ef03a85979f01fa1ae98643b958980;p=pspp * strftime.c (my_strftime) [HAVE_STRFTIME && ! (_NL_CURRENT && HAVE_STRUCT_ERA_ENTRY)]: Initialize the first byte of ubuf[]. --- diff --git a/lib/ChangeLog b/lib/ChangeLog index 8dbabb6e33..07f84b0d15 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,12 @@ +2005-03-14 Jim Meyering + + * strftime.c (my_strftime) [HAVE_STRFTIME && ! (_NL_CURRENT + && HAVE_STRUCT_ERA_ENTRY)]: Initialize the first byte of ubuf[] + to be nonzero so that we (and caller) can detect the difference + between a valid zero-length expansion and an error return, even + when the underlying strftime fails before writing anything into + that location. + 2005-03-10 Jim Meyering * save-cwd.c [!HAVE_FCHDIR]: Define open, fchdir, and chdir_long diff --git a/lib/strftime.c b/lib/strftime.c index 8085a59925..78a963b421 100644 --- a/lib/strftime.c +++ b/lib/strftime.c @@ -776,6 +776,7 @@ my_strftime (CHAR_T *s, size_t maxsize, const CHAR_T *format, *u++ = modifier; *u++ = format_char; *u = '\0'; + ubuf[0] = '\1'; len = strftime (ubuf, sizeof ubuf, ufmt, tp); if (len == 0 && ubuf[0] != '\0') return 0;