Subject: | Missing error checking for write to logfile |
This bug has been reported in Debian at
<http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294972>.
When the filesystem is full or the user has insufficient permissions to
write the lock file, LockFile::Simple will retry until its timeout
instead of failing instantly. The attached patch fixes this problem.
It's an updated version of the patch posted to the Debian bug tracking
system.
Subject: | handle-print-error.patch |
Description: Detect lock file creation errors
Author: Baurzhan Ismagulov <ibr@radix50.net>
Author: Maximilian Gass <mxey@cloudconnected.org>
Origin: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294972
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294972
--- a/Simple.pm
+++ b/Simple.pm
@@ -422,7 +422,16 @@
# Attempt to create lock
if (open(FILE, ">$lockfile")) {
local $\ = undef;
- print FILE "$stamp\n";
+ my $buf = "$stamp\n";
+ if (!syswrite(FILE, $buf, length($buf))) {
+ &$wfunc("writing to $lockfile: $!\n");
+ close(FILE);
+ if (!unlink($lockfile)) {
+ &$wfunc("removing $lockfile: $!");
+ }
+ umask($mask);
+ return 0; # Couldn't write to file
+ }
close FILE;
open(FILE, $lockfile); # Check lock
my $l;