From: Patrick Monnerat Date: Sun, 14 Apr 2024 12:20:28 +0000 (+0200) Subject: mprintf: check fputc error rather than matching returned character X-Git-Tag: curl-8_8_0~234 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6e8a6039b84d0bb78a482d896ec0d00c4e0989ff;p=thirdparty%2Fcurl.git mprintf: check fputc error rather than matching returned character OS/400 ascii fputc wrapper deviates from the posix standard by the fact that it returns the ebcdic encoding of the original ascii character. Testing for a matching value for success will then always fail. This commit replaces the chariacter comparison by an explicit error return check. Follow-up to ef2cf58 Closes #13367 --- diff --git a/lib/mprintf.c b/lib/mprintf.c index 4c60d13305..3ce3a7788c 100644 --- a/lib/mprintf.c +++ b/lib/mprintf.c @@ -1160,9 +1160,7 @@ static int fputc_wrapper(unsigned char outc, void *f) int out = outc; FILE *s = f; int rc = fputc(out, s); - if(rc == out) - return 0; - return 1; + return rc == EOF; } int curl_mprintf(const char *format, ...)