lockfile/unix/c

Lloyd Kremer kremer at cs.odu.edu
Sat Apr 15 02:25:30 AEST 1989



In article <3012 at hound.UUCP> rkl1 at hound.UUCP (K.LAUX) writes:

>after opening a file with O_CREAT, I close the file, then
>reopen it with another open call, because O_CREAT will only let you
>write to the file, and I usually need read/write permission.


My experience has been that you can't assume any particular read/write
capability from a file opened with O_CREAT only.  O_CREAT alone will often
simply create the file (take out a directory entry under that name).  To be
portable, O_CREAT should always be combined with exactly one of O_RDONLY,
O_WRONLY, or O_RDWR, according to what you wish to do with the file.

O_TRUNC or O_EXCL are often combined with O_CREAT, also.


					Lloyd Kremer
					Brooks Financial Systems
					{uunet,sun,...}!xanth!brooks!lloyd



More information about the Comp.unix.questions mailing list