On 12 May 2015 at 12:56, Daniel Bastos <[email protected]> wrote:

> % cp /fd/1 /fd/0
> cp: can't open /fd/1: '/fd/1' inappropriate use of fd
>
> I can't open it for reading, but I could open it for writing. Why can't I
> open it for reading?
>

The file open on file descriptor 1 wasn't itself opened for reading, only
writing. Check with ls -l /fd/1:

h% ls -l /fd/0 /fd/1
--r-------- d 0 bootes bootes 0 Jul  2  2014 /fd/0
---w------- d 0 bootes bootes 0 Jul  2  2014 /fd/1

The "bootes" is wrong, though: the driver should use up->user (not
hostowner, or even the owner of the underlying file).
You'll notice that someone else had /fd/1 with both r and w, in which case
cp /fd/1 /fd/0 would instead have complained about /fd/0
since /fd/1 could be opened, but /fd/0 can't be written.

Reply via email to