Xref: utzoo comp.unix.questions:12826 comp.lang.c:17618 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!apple!amdahl!kucharsk From: kucharsk@uts.amdahl.com (William Kucharski) Newsgroups: comp.unix.questions,comp.lang.c Subject: Re: lockfile/unix/c Keywords: c, unix, lockf Message-ID: <18gKx90ToP1010Y2K7U@amdahl.uts.amdahl.com> Date: 13 Apr 89 05:32:19 GMT References: <6307@homxc.ATT.COM> Reply-To: kucharsk@amdahl.uts.amdahl.com (William Kucharski) Organization: Amdahl Coup, UTS Products Hen House Lines: 18 Calls to lockf(3C) must be made with a file descriptor opened to either O_WRONLY or O_RDWR modes. So, change your code to read: fd = open(FILENAME, O_CREAT | O_RDWR, 0666); lockf(fd, F_LOCK, (long)0); Everything will work just fine. -- William Kucharski ARPA: kucharsk@uts.amdahl.com UUCP: ...!{ames,decwrl,sun,uunet}!amdahl!kucharsk Disclaimer: The opinions expressed above are my own, and may not agree with those of any other sentient being, not to mention those of my employer. So there.