Skip Menu |

This queue is for tickets about the LockFile-Simple CPAN distribution.

Report information
The Basics
Id: 12377
Status: new
Priority: 0/
Queue: LockFile-Simple

People
Owner: Nobody in particular
Requestors: ewilhelm [...] sbcglobal.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: error checking on close()
Date: Thu, 21 Apr 2005 12:14:06 -0700 From: Eric Wilhelm <ewilhelm@sbcglobal.net> Subject: error checking on close() To: Raphael Manfredi <Raphael_Manfredi@pobox.com> Raphael, I ran into a problem with the debmirror program which took me quite a while to track down. The disk was full, but instead of being told this, I was just getting "use of uninitialized variable" messages from the chop() statement in _acs_lock(). # Attempt to create lock if (open(FILE, ">$lockfile")) { local $\ = undef; print FILE "$stamp\n"; close FILE; # here it looks like you are opening the file again # to ensure that the write worked? open(FILE, $lockfile); # Check lock my $l; chop($l = <FILE>); $locked = $l eq $stamp; $l = <FILE>; # Must be EOF $locked = 0 if defined $l; close FILE; last if $locked; # Lock seems to be ours Maybe you want to do something like this at the first close(): unless(close(FILE)) { carp("error in writing lockfile $lockfile ($!)"); unlink($lockfile); # maybe not (your call) return(0); } That $! would contain the OS error (in my case "no space left on device"), which would be very helpful. Thanks, Eric