]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
cat: fix splice() from empty input
authorPádraig Brady <P@draigBrady.com>
Thu, 9 Apr 2026 10:17:10 +0000 (11:17 +0100)
committerPádraig Brady <P@draigBrady.com>
Thu, 9 Apr 2026 15:39:06 +0000 (16:39 +0100)
* src/cat.c (splice_cat): Ensure we don't retry a read() after
splice() completes, as this is significant on a tty.

src/cat.c

index e920e4bee76346d29903209a33e8102c074d6f2a..f1e2c85aff81940be73c20bd89df4fa99fb8f63c 100644 (file)
--- a/src/cat.c
+++ b/src/cat.c
@@ -593,6 +593,8 @@ splice_cat (void)
          subsequent error is fatal.  If not, then fall back to read
          and write.  */
       in_ok = 0 <= bytes_read || ! some_copied;
+      if (bytes_read == 0)
+        some_copied = true;  /* Indicate splice complete.  */
       if (bytes_read <= 0)
         goto done;
       /* We need to drain the intermediate pipe to standard output.  */