Explorar o código

* fix apt-pkg/cdrom.cc to umount the cdrom again if anything fails

Michael Vogt %!s(int64=21) %!d(string=hai) anos
pai
achega
cdadf54b3a
Modificáronse 3 ficheiros con 22 adicións e 3 borrados
  1. 14 2
      apt-pkg/cdrom.cc
  2. 1 1
      configure.in
  3. 7 0
      debian/changelog

+ 14 - 2
apt-pkg/cdrom.cc

@@ -567,7 +567,7 @@ bool pkgCdrom::Add(pkgCdromStatus *log)
    string DFile = _config->FindFile("Dir::State::cdroms");
    if (FileExists(DFile) == true)
    {
-      if (ReadConfigFile(Database,DFile) == false)
+      if (ReadConfigFile(Database,DFile) == false) 
 	 return _error->Error("Unable to read the cdrom database %s",
 			      DFile.c_str());
    }
@@ -650,8 +650,11 @@ bool pkgCdrom::Add(pkgCdromStatus *log)
       log->Update(msg.str(), STEP_SCAN);
    }
 
-   if (List.size() == 0 && SourceList.size() == 0)
+   if (List.size() == 0 && SourceList.size() == 0) 
+   {
+      UnmountCdrom(CDROM);
       return _error->Error("Unable to locate any package files, perhaps this is not a Debian Disc");
+   }
 
    // Check if the CD is in the database
    string Name;
@@ -687,7 +690,10 @@ bool pkgCdrom::Add(pkgCdromStatus *log)
 	  Name.empty() == true)
       {
 	 if(!log) 
+         {
+	    UnmountCdrom(CDROM);
 	    return _error->Error("No disc name found and no way to ask for it");
+	 }
 
 	 while(true) {
 	    if(!log->AskCdromName(Name)) {
@@ -760,7 +766,10 @@ bool pkgCdrom::Add(pkgCdromStatus *log)
    {
       string::size_type Space = (*I).find(' ');
       if (Space == string::npos)
+      {
+	 UnmountCdrom(CDROM);
 	 return _error->Error("Internal error");
+      }
 
       if(log) {
 	 msg.str("");
@@ -774,7 +783,10 @@ bool pkgCdrom::Add(pkgCdromStatus *log)
    {
       string::size_type Space = (*I).find(' ');
       if (Space == string::npos)
+      {
+	 UnmountCdrom(CDROM);
 	 return _error->Error("Internal error");
+      }
 
       if(log) {
 	 msg.str("");

+ 1 - 1
configure.in

@@ -18,7 +18,7 @@ AC_CONFIG_AUX_DIR(buildlib)
 AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in)
 
 dnl -- SET THIS TO THE RELEASE VERSION --
-AC_DEFINE_UNQUOTED(VERSION,"0.6.41")
+AC_DEFINE_UNQUOTED(VERSION,"0.6.41.1")
 PACKAGE="apt"
 AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE")
 AC_SUBST(PACKAGE)

+ 7 - 0
debian/changelog

@@ -1,3 +1,10 @@
+apt (0.6.41.1) unstable; urgency=low
+
+  * apt-pkg/cdrom.cc:
+    - unmount the cdrom when apt failed to locate any package files
+
+ -- Michael Vogt <michael.vogt@ubuntu.com>  Mon, 12 Sep 2005 13:45:53 +0200
+
 apt (0.6.41) unstable; urgency=low
 
   * improved the support for "error" and "conffile" reporting from