]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/indexcopy.cc
do not do the same looping twice
[apt.git] / apt-pkg / indexcopy.cc
index 0e36b3ded7cbf60d4f8d5cc3a75dfe85344863ff..7694cb1dd44f78a9bd6c454e50d79f6ecddc84d6 100644 (file)
@@ -106,9 +106,9 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List,
       } else {
          Target.Open(TargetF,FileFd::WriteAtomic);
       }
       } else {
          Target.Open(TargetF,FileFd::WriteAtomic);
       }
-      FILE *TargetFl = fdopen(dup(Target.Fd()),"w");
       if (_error->PendingError() == true)
         return false;
       if (_error->PendingError() == true)
         return false;
+      FILE *TargetFl = fdopen(dup(Target.Fd()),"w");
       if (TargetFl == 0)
         return _error->Errno("fdopen","Failed to reopen fd");
       
       if (TargetFl == 0)
         return _error->Errno("fdopen","Failed to reopen fd");
       
@@ -544,11 +544,9 @@ bool SigVerify::CopyMetaIndex(string CDROM, string CDName,         /*{{{*/
       FileFd Rel;
       Target.Open(TargetF,FileFd::WriteAtomic);
       Rel.Open(prefix + file,FileFd::ReadOnly);
       FileFd Rel;
       Target.Open(TargetF,FileFd::WriteAtomic);
       Rel.Open(prefix + file,FileFd::ReadOnly);
-      if (_error->PendingError() == true)
-        return false;
       if (CopyFile(Rel,Target) == false)
       if (CopyFile(Rel,Target) == false)
-        return false;
-   
+        return _error->Error("Copying of '%s' for '%s' from '%s' failed", file.c_str(), CDName.c_str(), prefix.c_str());
+
       return true;
 }
                                                                        /*}}}*/
       return true;
 }
                                                                        /*}}}*/
@@ -603,6 +601,7 @@ bool SigVerify::CopyAndVerify(string CDROM,string Name,vector<string> &SigList,
                         (useInRelease ? inrelease.c_str() : releasegpg.c_str()));
         // something went wrong, don't copy the Release.gpg
         // FIXME: delete any existing gpg file?
                         (useInRelease ? inrelease.c_str() : releasegpg.c_str()));
         // something went wrong, don't copy the Release.gpg
         // FIXME: delete any existing gpg file?
+        delete MetaIndex;
         continue;
       }
 
         continue;
       }
 
@@ -716,9 +715,9 @@ bool TranslationsCopy::CopyTranslations(string CDROM,string Name,   /*{{{*/
       } else {
         Target.Open(TargetF,FileFd::WriteAtomic);
       }
       } else {
         Target.Open(TargetF,FileFd::WriteAtomic);
       }
-      FILE *TargetFl = fdopen(dup(Target.Fd()),"w");
       if (_error->PendingError() == true)
         return false;
       if (_error->PendingError() == true)
         return false;
+      FILE *TargetFl = fdopen(dup(Target.Fd()),"w");
       if (TargetFl == 0)
         return _error->Errno("fdopen","Failed to reopen fd");
       
       if (TargetFl == 0)
         return _error->Errno("fdopen","Failed to reopen fd");