X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/22f8568d5ffd0d3c90f9aadb3450afa4ab500a13..fb2894d268d4821e0dd4f2b803ff2043b1ec3162:/apt-pkg/cdrom.cc diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index 7e194e253..4a688a5e1 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -1,9 +1,6 @@ /* */ -#ifdef __GNUG__ -#pragma implementation "apt-pkg/cdrom.h" -#endif #include #include #include @@ -18,6 +15,7 @@ #include #include #include +#include #include "indexcopy.h" @@ -446,6 +444,9 @@ bool pkgCdrom::WriteSourceList(string Name,vector &List,bool Source) { F.getline(Buffer,sizeof(Buffer)); CurLine++; + if (F.fail() && !F.eof()) + return _error->Error(_("Line %u too long in source list %s."), + CurLine,File.c_str()); _strtabexpand(Buffer,sizeof(Buffer)); _strstrip(Buffer); @@ -588,7 +589,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()); } @@ -674,8 +675,12 @@ 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) + { + if (_config->FindB("APT::CDROM::NoMount",false) == false) + 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; @@ -700,7 +705,7 @@ bool pkgCdrom::Add(pkgCdromStatus *log) if(log) { msg.str(""); - ioprintf(msg, "Found label '%s'\n", Name.c_str()); + ioprintf(msg, _("Found label '%s'\n"), Name.c_str()); log->Update(msg.str()); } Database.Set("CD::" + ID + "::Label",Name); @@ -711,7 +716,11 @@ bool pkgCdrom::Add(pkgCdromStatus *log) Name.empty() == true) { if(!log) + { + if (_config->FindB("APT::CDROM::NoMount",false) == false) + UnmountCdrom(CDROM); return _error->Error("No disc name found and no way to ask for it"); + } while(true) { if(!log->AskCdromName(Name)) { @@ -786,7 +795,11 @@ bool pkgCdrom::Add(pkgCdromStatus *log) { string::size_type Space = (*I).find(' '); if (Space == string::npos) + { + if (_config->FindB("APT::CDROM::NoMount",false) == false) + UnmountCdrom(CDROM); return _error->Error("Internal error"); + } if(log) { msg.str(""); @@ -800,7 +813,11 @@ bool pkgCdrom::Add(pkgCdromStatus *log) { string::size_type Space = (*I).find(' '); if (Space == string::npos) + { + if (_config->FindB("APT::CDROM::NoMount",false) == false) + UnmountCdrom(CDROM); return _error->Error("Internal error"); + } if(log) { msg.str(""); @@ -814,7 +831,7 @@ bool pkgCdrom::Add(pkgCdromStatus *log) // Unmount and finish if (_config->FindB("APT::CDROM::NoMount",false) == false) { - log->Update(_("Unmounting CD-ROM..."), STEP_LAST); + log->Update(_("Unmounting CD-ROM...\n"), STEP_LAST); UnmountCdrom(CDROM); }