Hi,

I have a cgi script that writes to a disk file. It would be safest if I can
get an exclusive lock on the file. I had a look at the opentut and believe I
have followed that the example there. Here's what I have

               sysopen my $fh, $file_path, O_WRONLY || die "can't open
$file_path: $!\n";
                flock($fh,LOCK_EX) or die "can't lock $file_path: $!\n";
                seek($fh, 0, 2);   # Append to file
                print $fh $status."\n";
                print STDERR "$0: $! $?\n";
                close($fh);

I am getting the error
"Inappropriate ioctl for device 0"

The worst part about this problem is that it seems completely erratic.
Sometimes the string is written to the file and sometimes not. Sometimes I
get an error and sometimes not but it never dies and the user will think the
data has been written to file! Does anyone see something wrong with the
snippet above or have any insights on file-clocking they could offer.

Thanx,
Dp.

Reply via email to