r/w access to fd from creat()
Guy Harris
guy at sun.uucp
Wed May 15 16:58:41 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().
>
> Does anybody know of a way to change this (kernel mods are unacceptable)?
There isn't any which doesn't involve changing the kernel, except for
closing and reopening the file (which won't work in your case).
> One problem is that I occasionally need r/w access to a creat()ed fd which
> must have a mode of 0444 for exclusive lock purposes.
Try using "link" and "unlink" to/from a file for locking purposes; it means
the file doesn't have to be unwritable, and also means you can lock out the
superuser.
Guy Harris
More information about the Comp.unix.wizards
mailing list