]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/cdrom.cc
Update changelog
[apt.git] / apt-pkg / cdrom.cc
index a91fc7181f0da038799b7716dcf994ac206c7ef1..1b9e9851918f9fc8df7a75429a3b3bf45c161c4f 100644 (file)
@@ -169,6 +169,23 @@ int pkgCdrom::Score(string Path)
       Res += 10;
    if (Path.find("/debian/") != string::npos)
       Res -= 10;
+
+   // check for symlinks in the patch leading to the actual file
+   // a symlink gets a big penalty
+   struct stat Buf;
+   string statPath = flNotFile(Path);
+   string cdromPath = _config->FindDir("Acquire::cdrom::mount","/cdrom/");
+   while(statPath != cdromPath && statPath != "./") {
+      statPath.resize(statPath.size()-1);  // remove the trailing '/'
+      if (lstat(statPath.c_str(),&Buf) == 0) {
+        if(S_ISLNK(Buf.st_mode)) {
+           Res -= 60;
+           break;
+        }
+      }
+      statPath = flNotFile(statPath); // descent
+   }
+
    return Res;
 }