79443648

Date: 2025-02-16 17:51:04
Score: 0.5
Natty:
Report link

The problem is that standard input is not always a pipe, and splice(2) requires at least one side to be a pipe.

$ ./test < test.c
splice: Invalid argument
(exit: 1)
$ cat test.c | ./test
$ ./test
(exit: 1)

In the first case, standard input is a file, which cannot be spliced. In the second case, it is a pipe. In the third case, it's a character device i.e. my terminal.

Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Runxi Yu