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?
In reply to Re: flock seek flush
by Loops
in thread flock seek flush
by jabowery
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |