lockfile/unix/c

William Kucharski kucharsk at uts.amdahl.com
Thu Apr 13 15:32:19 AEST 1989


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 at 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.



More information about the Comp.unix.questions mailing list