in reply to Question about flock and printing to file

why does it behave like this?

Because the locks are merely advisory? As you have not provided an example of your "corrupted/wrongly printed" data we can only guess that some other process isn't honouring the advisory lock.

  • Comment on Re: Question about flock and printing to file