Any flaws with the test for flock() functionality? 
Author Message
 Any flaws with the test for flock() functionality?

I have written a CGI (perl) script that utilises
the flock() function.

I plan on getting webmasters to test that file locking
works on their server by firstly running the attached cgi
script from within their browser.

So webmaster simply installs script in their cgi-bin, alters
"$testfile" and then keys the following into their browser:


It seems to work OK - can anyone see any flaws anywhere?

------start script-----

# Put your path to 'test.out' on the next line
$testfile = "/home/adam/www/Affsys/test.out";

use Fcntl qw(:flock);
open (FILE, "$testfile") || Error("open", "'$testfile'");
flock (FILE, LOCK_SH) || Error("lock", "'$testfile'");
print "Content-type: text/html\n\n";
print "If you see this message then file locking is supported on\n";
print "this host!\n";

sub Error {
 print "Content-type: text/html\n\n";
 print "Unable to $_[0] $_[1]: $! \n";


-------end script-------

Tue, 21 Sep 2004 21:53:34 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Flock functionality

2. make test failures on File::Flock

3. Perl script to check for DNS configuration flaws?

4. HTML::Element bug or flaw (entities) ?

5. Flaw in POSIX::mktime

6. Benchmark Module Flaws

7. HTML::Element bug or flaw (entities) ?

8. Java's hidden flaw

9. Germans Find Pentium III Flaw - Your privacy - Expires 2/28/99

10. flock doesn't flock under perl/linux

11. Flock me here flock me there.

12. Workaround for FLOCK?/When is FLOCK not supported?


Powered by phpBB® Forum Software