tags 199204 patch
thanks

On Sun, Jun 29, 2003 at 04:14:23AM +0200, Marcin Owsiany wrote:
> 
> When locking /usr/share/info/dir fails, install-info matches the error
> message against a regexp to see if it should give the user a hint
> (delete stale lockfile).
> 
> However this doesn't work if user is using a non-english LC_MESSAGES,
> because then "$!" won't match even if the error indeed is EEXIST

The attached patch uses the return value of link(2) to detect if the lock
already exists.

PS: I also wonder if the "print STDERR" should not be replaced by a "die"
in this case.

Kind Regards,
-- 
Nekral
Index: scripts/install-info.pl
===================================================================
--- scripts/install-info.pl     (révision 256)
+++ scripts/install-info.pl     (copie de travail)
@@ -276,7 +276,7 @@
 
 if (!$nowrite && !link("$infodir/dir","$infodir/dir.lock")) {
     print STDERR "$name: failed to lock dir for editing! $!\n".
-        ($! =~ m/exists/i ? "try deleting $infodir/dir.lock ?\n" : '');
+        ($? == EEXIST ? "try deleting $infodir/dir.lock ?\n" : '');
 }
 
 open(OLD,"$infodir/dir") || &ulquit("open $infodir/dir: $!");

Reply via email to