in reply to flock seek flush
Flushing is handled automatically for you when locking or unlocking. It would be more clear if you explicitly issued the LOCK_UN above instead of relying on proper ordering of that step inside of close(). It would also be prudent to test & die() on the locking and unlocking steps.
Having said all that, the code you posted should really work as-is as long as you're not writing to a network filesystem. Are you 100% sure that the processes in question are writing the $logstring atomically in one operation? Is it possible that they're reading from a network feed themselves and writing incomplete data to your log?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: flock seek flush
by jabowery (Beadle) on Jul 18, 2013 at 16:37 UTC |