]> err.no Git - dpkg/commitdiff
Fix regression producing perl warnings on update-alternatives
authorGuillem Jover <guillem@debian.org>
Tue, 28 Aug 2007 02:09:22 +0000 (05:09 +0300)
committerGuillem Jover <guillem@debian.org>
Tue, 28 Aug 2007 02:11:35 +0000 (05:11 +0300)
Commit 0fafaf6a2f43c487167a9bfa3f7abc55dcde582c reverted a fix for usage
of uninitialized variables.

ChangeLog
scripts/update-alternatives.pl

index 143d00357523fc4289599f57a69b3e4be69ce16b..480ad25b54e296bc23d9998b1dd1d0c9f7e4107a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-08-28  Guillem Jover  <guillem@debian.org>
+
+       * 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  <guillem@debian.org>
 
        * scripts/dpkg-gencontrol.pl: Add comments about the second pass
index f0e71458491b386f55e6cf6e39a3071c018b3fe2..12eb2ec1a14888e9ea5ecb05c0cc34bd9bd0d3c6 100755 (executable)
@@ -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", $!));