Silly error with flock
Robert Brown
rlb at lavalite.asd.sgi.com
Thu Jan 10 03:30:14 AEST 1991
On the bottom of my copy of the flock manual page is the following:
Unlike BSD flock(2), attempts to acquire an exclusive lock on an fd
opened for reading but not writing will fail with EBADF, as will attempts
to acquire a shared lock on a write-only fd.
Also, your test
if ( lock <= 0) perror("open");
should be
if ( lock < 0) perror("open");
but that's unrelated to the condition you asked about
Hope that helps!
Bob Brown
------------------------------------------------------------------
Silicon Graphics, Inc. Advanced Systems Division
More information about the Comp.sys.sgi
mailing list