From: Guillem Jover Date: Tue, 28 Aug 2007 02:09:22 +0000 (+0300) Subject: Fix regression producing perl warnings on update-alternatives X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0aff794d30f17540a76c6b231e783cf2180fe9ef;p=dpkg Fix regression producing perl warnings on update-alternatives Commit 0fafaf6a2f43c487167a9bfa3f7abc55dcde582c reverted a fix for usage of uninitialized variables. --- diff --git a/ChangeLog b/ChangeLog index 143d0035..480ad25b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-08-28 Guillem Jover + + * scripts/update-alternatives.pl: Fix regression introduced on commit + from 2007-08-08, which was producing a warning due to usage of + uninitialized variables. + 2007-08-28 Guillem Jover * scripts/dpkg-gencontrol.pl: Add comments about the second pass diff --git a/scripts/update-alternatives.pl b/scripts/update-alternatives.pl index f0e71458..12eb2ec1 100755 --- a/scripts/update-alternatives.pl +++ b/scripts/update-alternatives.pl @@ -595,12 +595,14 @@ if ($mode eq 'auto') { unlink("$slink") || $! == &ENOENT || &quit(sprintf(_g("unable to remove %s: %s"), $slink, $!)); } else { - if (!defined($linkname= readlink($slink)) && $! != ENOENT) { + $linkname = readlink($slink); + if (!defined($linkname) && $! != ENOENT) { pr(sprintf(_g("warning: %s is supposed to be a slave symlink to\n". " %s, or nonexistent; however, readlink failed: %s"), $slink, "$altdir/$sname", $!)) if $verbosemode > 0; - } elsif ($linkname ne "$altdir/$sname") { + } elsif (!defined($linkname) || + (defined($linkname) && $linkname ne "$altdir/$sname")) { unlink("$slink.dpkg-tmp") || $! == ENOENT || quit(sprintf(_g("unable to ensure %s nonexistent: %s"), "$slink.dpkg-tmp", $!));