]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/indexcopy.cc
improve test some more
[apt.git] / apt-pkg / indexcopy.cc
index 3747e357003a1cd0e8ae05f468a833bf745bd241..db3d10ecd64dcfc78a4ee6a493a104f55fc63642 100644 (file)
@@ -85,7 +85,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List,
       string OrigPath = string(*I,CDROM.length());
       
       // Open the package file
-      FileFd Pkg(*I + GetFileName(), FileFd::ReadOnly, FileFd::Extension);
+      FileFd Pkg(*I + GetFileName(), FileFd::ReadOnly, FileFd::Auto);
       off_t const FileSize = Pkg.Size();
 
       pkgTagFile Parser(&Pkg);
@@ -648,16 +648,12 @@ bool SigVerify::RunGPGV(std::string const &File, std::string const &FileGPG,
 {
    if (File == FileGPG)
    {
-      #define SIGMSG "-----BEGIN PGP SIGNED MESSAGE-----\n"
-      char buffer[sizeof(SIGMSG)];
       FILE* gpg = fopen(File.c_str(), "r");
       if (gpg == NULL)
         return _error->Errno("RunGPGV", _("Could not open file %s"), File.c_str());
-      char const * const test = fgets(buffer, sizeof(buffer), gpg);
       fclose(gpg);
-      if (test == NULL || strcmp(buffer, SIGMSG) != 0)
+      if (!IsPgpClearTextSignature(File))
         return _error->Error(_("File %s doesn't start with a clearsigned message"), File.c_str());
-      #undef SIGMSG
    }
 
 
@@ -797,7 +793,7 @@ bool TranslationsCopy::CopyTranslations(string CDROM,string Name,   /*{{{*/
       string OrigPath = string(*I,CDROM.length());
 
       // Open the package file
-      FileFd Pkg(*I, FileFd::ReadOnly, FileFd::Extension);
+      FileFd Pkg(*I, FileFd::ReadOnly, FileFd::Auto);
       off_t const FileSize = Pkg.Size();
 
       pkgTagFile Parser(&Pkg);