in reply to Re: Question about flock and printing to file
in thread Question about flock and printing to file

IMHO flock just isn't worth using, it's almost entirely pointless.

flock is advisory, that's true. But to conclude that flock is useless is just wrong.

flock won't prevent a malicious (or clueless) other process from damaging a file. But as long as all processes agree on using flock to access the file, no damage will happen. Period. Unless, of course, the file is on NFS or other network filesystems (SMB, AFS, ...). At least some versions of NFS have locking problems, other network filesystems may have them, too.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
  • Comment on Re^2: Question about flock and printing to file

Replies are listed 'Best First'.
Re^3: Question about flock and printing to file
by AnomalousMonk (Archbishop) on Jun 23, 2015 at 17:19 UTC
    ... as long as all processes agree on using flock to access the file, no damage will happen. Period. Unless, of course, ...

    Unfortunately, Dave, that sounds a lot like Famous Last Words.


    Give a man a fish:  <%-(-(-(-<