3

Basically I ran the following as a test:

$ gcc -c -xc - -o /dev/stdout <<<'int main(){return 0;}'

I got an error (Fatal error: can't write /dev/stdout: Illegal seek), and I then found that (presumably as a clean-up step) gcc deleted /dev/stdout. Now when I run for example echo foo > /dev/stdout, it just creates an ordinary text file at that location.

Can I just create it again as a symlink?:

$ ln -s /proc/self/fd/1 /dev/stdout

Or is there more to it than that?

How can I prevent this from happening again? I realize that /dev/stdout needs to have write permissions for everyone for it to work properly.

Matt
  • 21,026
  • 18
  • 63
  • 115

0 Answers0