summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2005-09-12 13:51:58 +0000
committerMichael Vogt <michael.vogt@ubuntu.com>2005-09-12 13:51:58 +0000
commit1c19f1a34b96b7cc21798c47ef572661f103aec9 (patch)
treed09769a983e5562378431cd537db83beda4d741a /apt-pkg
parente3c00bf5af56e2575ffb0db49dd6d706544ca30b (diff)
parentcdadf54b3ab67aed6e9ecf902aabf4cc9896ef9e (diff)
* backported a fix from apt-cdrom so that it umounts it's cdrom again in case of error
Patches applied: * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-55 * fix apt-pkg/cdrom.cc to umount the cdrom again if anything fails
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/cdrom.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc
index ca74aa685..d7ef844a2 100644
--- a/apt-pkg/cdrom.cc
+++ b/apt-pkg/cdrom.cc
@@ -564,7 +564,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());
}
@@ -647,8 +647,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;
@@ -684,7 +687,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)) {
@@ -757,7 +763,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("");
@@ -771,7 +780,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("");