States that "flock FH, LOCK_UN" doesn't flush the buffer -- not true.
Well, it *is* true for many folks ;-) And if one is writing a module for public consumption (or for any environment that the potentially don't have complete control of), it is best to be safe. Heating up the pipes of a filehandle that already has buffering turned off can't hurt in this case, it can only ensure safety.
It states that flock() may fail if FH is not open. True. But then it also states that the file will be modified because flock() failed. Not true. How are you going to modify the file if FH is not defined? ;)
The point of Trap #2 is that the flock() system call may fail for some reason. If one doesn't check for a failure of the system call, one could end up modifying a file that they couldn't obtain a lock on, which probably wouldn't be the intended result.
-- dug | [reply] [d/l] |