From: Bruno Haible Date: Sat, 1 Nov 2025 07:58:08 +0000 (+0100) Subject: fprintftime: Return -1 on output error. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=90108083de31d12f30c58b6686569e1845ca9a0c;p=thirdparty%2Fgnulib.git fprintftime: Return -1 on output error. * lib/strftime.c (FPUTC): On failure, return FAILURE, not EOF. (width_cpy) [FPRINTFTIME]: Write -1 as FAILURE, for consistency. --- diff --git a/ChangeLog b/ChangeLog index d103d7bc0e..c02c1c14b9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2025-11-01 Bruno Haible + + fprintftime: Return -1 on output error. + * lib/strftime.c (FPUTC): On failure, return FAILURE, not EOF. + (width_cpy) [FPRINTFTIME]: Write -1 as FAILURE, for consistency. + 2025-10-31 Paul Eggert fprintftime: return negative on output error diff --git a/lib/strftime.c b/lib/strftime.c index f18e8f65cd..41e7c5477c 100644 --- a/lib/strftime.c +++ b/lib/strftime.c @@ -234,7 +234,7 @@ typedef sbyte_count_t retval_t; { \ int _r = fputc (Byte, P); \ if (_r < 0) \ - return _r; \ + return FAILURE; \ } \ while (false) @@ -308,7 +308,7 @@ typedef sbyte_count_t retval_t; for (byte_count_t _i = 0; _i < _n; _i++) \ FPUTC (TOUPPER ((UCHAR_T) _s[_i], loc), p); \ else if (fwrite (_s, _n, 1, p) == 0) \ - return -1; \ + return FAILURE; \ } \ while (0) \ )