From: Paul Eggert Date: Sat, 1 Nov 2025 04:10:58 +0000 (-0600) Subject: fprintftime: omit unnecessary errno restore X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2ca20d5c60fd6f12c122f0190a529cf8ff4b1a7;p=thirdparty%2Fgnulib.git fprintftime: omit unnecessary errno restore * lib/strftime.c (__strftime_internal) [FPRINTFTIME]: Do not restore errno if there is no error, as the API does not promise this. --- diff --git a/ChangeLog b/ChangeLog index 055b124247..aaedd7a74c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2025-10-31 Paul Eggert + + fprintftime: omit unnecessary errno restore + * lib/strftime.c (__strftime_internal) [FPRINTFTIME]: + Do not restore errno if there is no error, + as the API does not promise this. + 2025-10-31 Bruno Haible posix_spawn_file_actions_addclose: Ignore test failure on NetBSD 10.0. diff --git a/lib/strftime.c b/lib/strftime.c index afb783778e..2d8eda5622 100644 --- a/lib/strftime.c +++ b/lib/strftime.c @@ -1199,9 +1199,9 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) #endif #if FPRINTFTIME byte_count_t maxsize = SBYTE_COUNT_MAX; -#endif - +#else int saved_errno = errno; +#endif #ifdef _NL_CURRENT /* We cannot make the following values variables since we must delay @@ -2415,8 +2415,8 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) #if ! FPRINTFTIME if (p && maxsize != 0) *p = L_('\0'); + errno = saved_errno; #endif - errno = saved_errno; return i; }