r/w access to fd from creat() + new question

Alan Fargusson alan at drivax.UUCP
Thu May 16 13:28:47 AEST 1985


> It has been my experience that the file descriptor returned from a successful
> invocation of creat() is writaable but not readable, regardless of the mode
> specified to creat().

I have thought that this characteristic is nieve. You can get around it
by doing a creat followed by an open. Of course you can only have 10 open
files unless you remember to close the fd returned by the create.

Now for my question (in the same vain). Why do things like chmod, and link,
take a path name, not a fd? I understand that unlink needs a path name because
it is an operation on a directory as much as on a file. But link has to take
a path name and open it in a way, then make the link. I have had one case
where I had to save a file name so I could pass it to link where I had the
fd. But this could fail if someone unlinked the file while I had it open.
-- 

Alan Fargusson.

{ ihnp4, sftig, amdahl, ucscc, ucbvax!unisoft }!drivax!alan



More information about the Comp.unix.wizards mailing list