Преглед изворни кода

* scripts/update-alternatives.pl: Move the ENOENT errno check from
the if conditionals to the block body to avoid comparing against an
undef value on the next elsif conditional.

Guillem Jover пре 19 година
родитељ
комит
273eaa85a7
2 измењених фајлова са 10 додато и 4 уклоњено
  1. 6 0
      ChangeLog
  2. 4 4
      scripts/update-alternatives.pl

+ 6 - 0
ChangeLog

@@ -1,3 +1,9 @@
+2007-05-02  Guillem Jover  <guillem@debian.org>
+
+	* scripts/update-alternatives.pl: Move the ENOENT errno check from
+	the if conditionals to the block body to avoid comparing against an
+	undef value on the next elsif conditional.
+
 2007-04-28  Aaron M. Ucko  <ucko@debian.org>
 
 	* scripts/dpkg-shlibdeps.pl (unique_libfiles): New variable. Do not

+ 4 - 4
scripts/update-alternatives.pl

@@ -530,10 +530,10 @@ if ($manual eq 'auto') {
             &quit(sprintf(_g("unable to remove %s: %s"), "$admindir/$name", $!));
         exit(0);
     } else {
-        if (!defined($linkname= readlink($link)) && $! != &ENOENT) {
+        if (!defined($linkname = readlink($link))) {
             &pr(sprintf(_g("warning: %s is supposed to be a symlink to %s\n".
                 " (or nonexistent); however, readlink failed: %s"), $link, "$altdir/$name", $!))
-              if $verbosemode > 0;
+		if  $! != ENOENT && $verbosemode > 0;
         } elsif ($linkname ne "$altdir/$name") {
             unlink("$link.dpkg-tmp") || $! == &ENOENT ||
                 &quit(sprintf(_g("unable to ensure %s nonexistent: %s"), "$link.dpkg-tmp", $!));
@@ -564,10 +564,10 @@ if ($manual eq 'auto') {
     for (my $j = 0; $j <= $#slavenames; $j++) {
         $sname= $slavenames[$j];
         $slink= $slavelinks[$j];
-        if (!defined($linkname= readlink($slink)) && $! != &ENOENT) {
+        if (!defined($linkname = readlink($slink))) {
             &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;
+		if  $! != ENOENT && $verbosemode > 0;
         } elsif ($linkname ne "$altdir/$sname") {
             unlink("$slink.dpkg-tmp") || $! == &ENOENT ||
                 &quit(sprintf(_g("unable to ensure %s nonexistent: %s"), "$slink.dpkg-tmp", $!));