From 6e8a6039b84d0bb78a482d896ec0d00c4e0989ff Mon Sep 17 00:00:00 2001 From: Patrick Monnerat Date: Sun, 14 Apr 2024 14:20:28 +0200 Subject: [PATCH] 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 --- lib/mprintf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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, ...) -- 2.47.3