tye, Thanks for the input. I tried your suggestion, and when configured as you suggest, the flock dies with the message "Resource temporarily unavailable". Wow. What does that mean? I mean, it says what it says, yeah. But what does it really mean, in terms of flocking? It's quite strange. When I made a temp directory of my own "/home/username/htdocs/tmp" and made it chmod 777, it was able to flock just fine.
in reply to Re: More Eyes
in thread More Eyes, Please
So is there an issue with flocking files which are not in your own userspace (i.e. /tmp or something), perhaps?
Update: Incidentally, I got this very same result with the script on two different machines: one running Slack 7, and the other running FreeBSD 3.1
Update 2: I just had to try the simplest version, so I did this:
And it ran just fine. Go figure. I'm quite puzzled.
use Fcntl qw( :flock );
print "Content-type: text/html\n\n";
print "Testing flocking now.<BR>\n";
open(TMP, "+> $tempfile") or die "Could not open tempfile: $!";
flock(TMP, LOCK_EX|LOCK_NB) or die "no lock: $!";
seek(TMP, 0, 0);
print TMP "Blah blah blah"; # just to test
print "That seemed to go just fine.\n";