Name: Anonymous 2011-01-20 16:21
Problem: The open call erases the file before the process has the lock
Now you have two problems:
Dear /prog/, what am I missing?
open F, "> somefile"; # DERP you already erased all the data in somefile by opening it
flock F, LOCK_EX; # before obtaining this lock
# Now write F
close F;Now you have two problems:
+< still erases the file before the process has the lock open F, "+< somefile";
flock F, LOCK_EX;
truncate F, 0;
# Now write F
close F;Dear /prog/, what am I missing?