From a discussion on useless use of cat.
I decided to see if It was possible to avoid some of the troubles by changing the owner of the pipe. So I did:
# cat | cat &
[1] 16500
# cd /proc/16500/fd
# ls -l
lr-x------ root root 0 -> pipe:[931613]
lrwx------ root root 1 -> /dev/tty1
lrwx------ root root 2 -> /dev/tty1
# chown --dereference daemon 0
# ls -l
lr-x------ root root 0 -> pipe:[931613]
lrwx------ root root 1 -> /dev/tty1
lrwx------ root root 2 -> /dev/tty1
I also tried chown
and chown -L
. No go. I'm convinced this is simply impossible, but why? They clearly have inodes. That 931613 is the inode number.
In the case I am actually interested in, the process on the right would be running at lower privileges and I'd kind of like it to own its own handles so that it can re-open them.