]> git.ipfire.org Git - pakfire.git/commitdiff
tests: Fail with error code if fgetc() returns an error
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 18 Mar 2025 16:59:40 +0000 (16:59 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 18 Mar 2025 16:59:40 +0000 (16:59 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
tests/stub/command.c

index 9fdcce41c80037f7be9ebb097ec205d2dce3096a..053661b56a13856ebf2676716717b00959057257 100644 (file)
@@ -18,6 +18,7 @@
 #                                                                             #
 #############################################################################*/
 
+#include <errno.h>
 #include <linux/limits.h>
 #include <mntent.h>
 #include <stdio.h>
@@ -354,7 +355,7 @@ static int _pipe(int argc, char* argv[]) {
 
                // Break if we are done reading
                if (c == EOF)
-                       break;
+                       return errno;
 
                // Write the character to stdout
                r = fputc(c, stdout);
@@ -367,8 +368,6 @@ static int _pipe(int argc, char* argv[]) {
                                break;
                }
        }
-
-       return 0;
 }
 
 /*