cosmopolitan/test/libc/fmt
Gabriel Ravier 9c6d78c26d
Fix vfprintf and derived functions not handling write errors (#798)
The C standard states:
> The fprintf function returns the number of characters transmitted,
> or a negative value if an output or encoding error occurred or if
> the implementation does not support a specified width length
> modifier.
- C Standard, 7.23.6.1.15. The fprintf function

However, cosmopolitan fails to return a negative value in the case of
an output error, meaning that a program such as:

 #include <stdio.h>

int main()
{
    FILE *fp = fopen("/dev/full", "w");

    setbuf(fp, NULL);
    printf("fprintf: %d\n", fprintf(fp, "test\n"));
    printf("fflush: %d\n", fflush(fp));
}

will, under cosmopolitan, print that no error occured in either of the
calls to fprintf and fflush.

This patch fixes this, along with the associated GitHub issue,
https://github.com/jart/cosmopolitan/issues/784
2023-03-31 09:57:29 -04:00
..
atoi_test.c Greatly expand system() shell code features 2022-10-11 21:30:31 -07:00
basename_test.c Pay off more technical debt 2022-09-12 23:36:56 -07:00
dirname_test.c Pay off more technical debt 2022-09-12 23:36:56 -07:00
encodenf32_test.c Fold LIBC_RAND into LIBC_STDIO/TINYMATH/INTRIN 2022-08-11 12:32:00 -07:00
fmt_test.c Fix issues 774, 782 and 789 (printf precision bugs) (#790) 2023-03-29 01:11:48 -07:00
formatbinary64_test.c Unbloat the build 2022-08-11 00:15:29 -07:00
formatflex64_test.c Unbloat the build 2022-08-11 00:15:29 -07:00
formathex64_test.c Unbloat the build 2022-08-11 00:15:29 -07:00
formatint64_test.c Do code cleanup use duff device linenoise i/o 2022-04-22 18:56:52 -07:00
formatint64thousands_test.c Pay off more technical debt 2022-09-12 23:36:56 -07:00
formatoctal32_test.c Do code cleanup use duff device linenoise i/o 2022-04-22 18:56:52 -07:00
formatoctal64_test.c Polish redbean serialization 2022-04-29 06:10:10 -07:00
fprintf_test.c Fix vfprintf and derived functions not handling write errors (#798) 2023-03-31 09:57:29 -04:00
imaxdiv_test.c Add imaxdiv, wcscoll, getdtablesize (#639) 2022-10-05 07:14:58 -07:00
itoa64radix16_test.c Change license 2020-12-27 17:18:44 -08:00
joinpaths_test.c Make improvements 2022-07-21 03:36:42 -07:00
lengthuint64_test.c Unbloat the build 2022-08-11 00:15:29 -07:00
palandprintf_test.c Fix memcpy(size=0) ubsan warning in vsnprintf() 2023-03-29 01:28:10 -07:00
printf_uppercase_e_static_yoink_test.c Fix PFLINK mechanism for uppercase float conversion specifiers (#796) 2023-03-29 22:18:59 -04:00
printf_uppercase_f_static_yoink_test.c Fix PFLINK mechanism for uppercase float conversion specifiers (#796) 2023-03-29 22:18:59 -04:00
printf_uppercase_g_static_yoink_test.c Fix PFLINK mechanism for uppercase float conversion specifiers (#796) 2023-03-29 22:18:59 -04:00
sizetol_test.c Make improvements 2022-08-15 15:20:36 -07:00
sleb128_test.c Productionize new APE loader and more 2021-10-02 08:27:03 -07:00
sprintf_s.inc Further refine printf long double change (#66) 2021-02-27 13:30:17 -08:00
sprintf_s_test.c Pay off more technical debt 2022-09-12 23:36:56 -07:00
sscanf_test.c Fix inttypes.h FAST16 macros to have a correct definition (#791) 2023-03-29 00:19:40 -07:00
strerror_r_test.c Fold LIBC_BITS into LIBC_INTRIN 2022-08-11 12:13:18 -07:00
stripexts_test.c Pay off more technical debt 2022-09-12 23:36:56 -07:00
test.mk Fix vfprintf and derived functions not handling write errors (#798) 2023-03-31 09:57:29 -04:00
timevaltofiletime_test.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
uleb64_test.c Add Compress() and Uncompress() to redbean 2022-05-16 16:49:20 -07:00
uleb128_test.c Productionize new APE loader and more 2021-10-02 08:27:03 -07:00
zleb64_test.c Pay off more technical debt 2022-09-12 23:36:56 -07:00