Xref: utzoo comp.unix.questions:12871 comp.lang.c:17660 Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!ukma!xanth!kremer From: kremer@cs.odu.edu (Lloyd Kremer) Newsgroups: comp.unix.questions,comp.lang.c Subject: Re: lockfile/unix/c Summary: O_CREAT observations Keywords: c, unix, lockf Message-ID: <8466@xanth.cs.odu.edu> Date: 14 Apr 89 16:25:30 GMT References: <6307@homxc.ATT.COM> <3012@hound.UUCP> Followup-To: comp.lang.c Organization: Old Dominion University, Norfolk, Va. Lines: 21 In article <3012@hound.UUCP> rkl1@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