]> git.saurik.com Git - apt.git/blobdiff - cmdline/apt-get.cc
fix apt-get download truncation (closes: #736962)
[apt.git] / cmdline / apt-get.cc
index 8a0772ce26b716b6a05834ff48b3c5b263892110..6bff6e7de5963d6097e976c2250f2a68b08aefb1 100644 (file)
@@ -678,14 +678,17 @@ bool DoDownload(CommandLine &CmdL)
 
    // copy files in local sources to the current directory
    for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); ++I)
 
    // copy files in local sources to the current directory
    for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); ++I)
-      if ((*I)->Local == true && (*I)->Status == pkgAcquire::Item::StatDone)
+   {
+      std::string const filename = cwd + flNotDir((*I)->DestFile);
+      if ((*I)->Local == true &&
+          filename != (*I)->DestFile &&
+          (*I)->Status == pkgAcquire::Item::StatDone)
       {
       {
-        std::string const filename = cwd + flNotDir((*I)->DestFile);
         std::ifstream src((*I)->DestFile.c_str(), std::ios::binary);
         std::ofstream dst(filename.c_str(), std::ios::binary);
         dst << src.rdbuf();
       }
         std::ifstream src((*I)->DestFile.c_str(), std::ios::binary);
         std::ofstream dst(filename.c_str(), std::ios::binary);
         dst << src.rdbuf();
       }
-
+   }
    return Failed == false;
 }
                                                                        /*}}}*/
    return Failed == false;
 }
                                                                        /*}}}*/
@@ -1677,14 +1680,6 @@ void SigWinch(int)
    if (ioctl(1, TIOCGWINSZ, &ws) != -1 && ws.ws_col >= 5)
       ScreenWidth = ws.ws_col - 1;
 #endif
    if (ioctl(1, TIOCGWINSZ, &ws) != -1 && ws.ws_col >= 5)
       ScreenWidth = ws.ws_col - 1;
 #endif
-}
-                                                                       /*}}}*/
-bool DoUpgrade(CommandLine &CmdL)                                      /*{{{*/
-{
-   if (_config->FindB("APT::Get::Upgrade-Allow-New", false) == true)
-      return DoUpgradeWithAllowNewPackages(CmdL);
-   else
-      return DoUpgradeNoNewPackages(CmdL);
 }
                                                                        /*}}}*/
 int main(int argc,const char *argv[])                                  /*{{{*/
 }
                                                                        /*}}}*/
 int main(int argc,const char *argv[])                                  /*{{{*/