]> git.saurik.com Git - apt.git/blobdiff - methods/bzip2.cc
merged from lp:~donkult/apt/experimental
[apt.git] / methods / bzip2.cc
index 241f21c66bd3a30588ef85c7e5bc9da223280a2b..eff83bda737e9b775039bc7fef948a6b475b5744 100644 (file)
@@ -13,6 +13,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/acquire-method.h>
@@ -56,12 +58,8 @@ bool Bzip2Method::Fetch(FetchItem *Itm)
    // Open the source and destination files
    FileFd From(Path,FileFd::ReadOnly);
 
-   // if the file is empty, just rename it and return
-   if(From.Size() == 0) 
-   {
-      rename(Path.c_str(), Itm->DestFile.c_str());
-      return true;
-   }
+   if(From.FileSize() == 0)
+      return _error->Error(_("Empty files can't be valid archives"));
 
    int GzOut[2];   
    if (pipe(GzOut) < 0)