From: Michael Tremer Date: Sat, 19 Oct 2024 12:33:31 +0000 (+0000) Subject: tests: Have pipe return an error if it could not write X-Git-Tag: 0.9.30~990 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=daee01e12f7ee56b7949158b25eb5ebecc22cc94;p=pakfire.git tests: Have pipe return an error if it could not write Signed-off-by: Michael Tremer --- diff --git a/tests/stub/command.c b/tests/stub/command.c index 3656ce391..9fdcce41c 100644 --- a/tests/stub/command.c +++ b/tests/stub/command.c @@ -358,15 +358,17 @@ static int _pipe(int argc, char* argv[]) { // Write the character to stdout r = fputc(c, stdout); - if (r == EOF) { - fprintf(stderr, "Could not write to stdout: %m\n"); - break; - } + switch (r) { + case EOF: + fprintf(stderr, "Could not write to stdout: %m\n"); + return 1; - r = 0; + default: + break; + } } - return r; + return 0; } /*