]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/clean.cc
merged r1970 lp:~vorlon/apt/lp.968828
[apt.git] / apt-pkg / clean.cc
index ed8fa1aa9c8dabac4ee5080b11cd2c901a275065..9c167eaa505b82b3ae593f5c226f9c20506d49a8 100644 (file)
@@ -54,9 +54,11 @@ bool pkgArchiveCleaner::Go(std::string Dir,pkgCache &Cache)
       struct stat St;
       if (stat(Dir->d_name,&St) != 0)
       {
       struct stat St;
       if (stat(Dir->d_name,&St) != 0)
       {
-        chdir(StartDir.c_str());
+        _error->Errno("stat",_("Unable to stat %s."),Dir->d_name);
         closedir(D);
         closedir(D);
-        return _error->Errno("stat",_("Unable to stat %s."),Dir->d_name);
+        if (chdir(StartDir.c_str()) != 0)
+           return _error->Errno("chdir", _("Unable to change to %s"), StartDir.c_str());
+        return false;
       }
       
       // Grab the package name
       }
       
       // Grab the package name
@@ -115,8 +117,9 @@ bool pkgArchiveCleaner::Go(std::string Dir,pkgCache &Cache)
       Erase(Dir->d_name,Pkg,Ver,St);
    };
    
       Erase(Dir->d_name,Pkg,Ver,St);
    };
    
-   chdir(StartDir.c_str());
    closedir(D);
    closedir(D);
-   return true;   
+   if (chdir(StartDir.c_str()) != 0)
+      return _error->Errno("chdir", _("Unable to change to %s"), StartDir.c_str());
+   return true;
 }
                                                                        /*}}}*/
 }
                                                                        /*}}}*/