Trying to reproduce this under HPUX (which I was able to do), I see that the second flock() fails with $! of "Bad file number" [even though fileno(FH) reports 3]. Smells like a bug in Perl's emulation of flock() using fcntl() locking [since HPUX doesn't have native flock()]. I think I'll dig some more...
Update! Here is the reason. Quoting "man fcntl":
The file descriptor on which a read lock is being placed must have been opened with read access.
So, since you don't open FH for read access, you can't get an emulated LOCK_SH on it at all. I wonder if Perl documents this... (nope, it doesn't -- time to write a patch).
So, of course, the work-around is to open "+>lock" instead.
- tye (but my friends call me "Tye")In reply to (tye)Re: flock on differents OSes
by tye
in thread flock on differents OSes
by philou
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |