+2025-11-01 Paul Eggert <eggert@cs.ucla.edu>
+
+ nstrftime: do not preserve errno on success
+ * NEWS: Mention this, and coalesce recent changes for the
+ benefit of future readers.
+ * lib/strftime.c (__strftime_internal):
+ Preserve errno only if FAILURE == 0,
+ for consistency with other functions returning -1 on failure.
+
2025-11-01 Bruno Haible <bruno@clisp.org>
openat2 tests: Avoid test failure on native Windows.
Date Modules Changes
-2025-10-31 nstrftime The return type changed from size_t to ptrdiff_t.
- c-nstrftime The return value in case of failure changed from 0
- to -1.
-
-2025-10-31 fprintftime The return value in case of failure changed from 0
- to -1.
-
-2025-10-30 fprintftime The return value is changed from size_t to off64_t.
+2025-11-01 nstrftime The return type is now signed not size_t,
+ c-nstrftime the failure return value is now -1 not 0,
+ fprintftime and errno is no longer preserved on success.
+ The return type is now off64_t for fprintftime,
+ ptrdiff_t for the others.
2025-08-05 git-merge-changelog This module is removed. Use the package from
https://git.savannah.gnu.org/git/vc-changelog.git
#endif
#if FPRINTFTIME
byte_count_t maxsize = SBYTE_COUNT_MAX;
-#else
+#endif
+#if FAILURE == 0
int saved_errno = errno;
#endif
#if ! FPRINTFTIME
if (p && maxsize != 0)
*p = L_('\0');
+#endif
+
+#if FAILURE == 0
errno = saved_errno;
#endif
Store the result, as a string with a trailing NUL character, at the
beginning of the array __S[0..__MAXSIZE-1] and return the length of
- that string, not counting the trailing NUL, and without changing errno.
+ that string, not counting the trailing NUL.
If unsuccessful, possibly change the array __S, set errno, and return -1;
errno == ERANGE means the string didn't fit.
This function is like strftime, but with two more arguments:
* __TZ instead of the local timezone information,
* __NS as the number of nanoseconds in the %N directive,
- and with a failure return value of -1 instead of 0.
+ and on success it does not preserve errno,
+ and on failure it returns -1 not 0.
*/
ptrdiff_t nstrftime (char *restrict __s, size_t __maxsize,
char const *__format,