man 2 flock lists only one error condition:
EWOULDBLOCK The file is locked and the LOCK_NB flag was selected.As cfreak suggests, some process (maybe yours) already has the lock.
Seeing your reply to cfreak, yes, a cgi environment may well be running more than one instance of your script. If LOCK_NB is not set, one instance will wait until the other lets go.
Update: Calling flock as flock FH, $opts or warn $!; will tell you what error is set. I don't understand why LOCK_NB is necessary to you. For most purposes, the blocking form is preferred. The effect is to sleep until the file is available.
After Compline,
Zaxo
In reply to Re: Can flock occasionally fail on systems that support file locking?
by Zaxo
in thread Can flock occasionally fail on systems that support file locking?
by rzward
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |