]> git.saurik.com Git - apt.git/commitdiff
* methods/{gzip,bzip2}.cc:
authorDavid Kalnischkies <kalnischkies@gmail.com>
Mon, 6 Sep 2010 10:17:15 +0000 (12:17 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Mon, 6 Sep 2010 10:17:15 +0000 (12:17 +0200)
  - empty files can never be valid archives (Closes: #595691)

debian/changelog
methods/bzip2.cc
methods/gzip.cc

index 4dca62603eba38ae79bf8228bc2803d464422aa0..07196db25d34d9e3aeed548adff32c570965ae5e 100644 (file)
@@ -13,8 +13,10 @@ apt (0.8.2) UNRELEASED; urgency=low
   * cmdline/apt-key:
     - support also Dir::Etc::Trusted so that apt-key works in the same
       way as the library part which works with the trusted files
+  * methods/{gzip,bzip2}.cc:
+    - empty files can never be valid archives (Closes: #595691)
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Sat, 04 Sep 2010 15:25:10 +0200
+ -- David Kalnischkies <kalnischkies@gmail.com>  Mon, 06 Sep 2010 12:16:58 +0200
 
 apt (0.8.1) unstable; urgency=low
 
index 241f21c66bd3a30588ef85c7e5bc9da223280a2b..c668141a2919622c7809b76fac64de55261ad8e4 100644 (file)
@@ -56,12 +56,9 @@ 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;
-   }
+   // FIXME add an error message saying that empty files can't be valid archives
+   if(From.Size() == 0)
+      return false;
 
    int GzOut[2];   
    if (pipe(GzOut) < 0)
index 5b9b66b50375769f1d528b11c00d116c03e0841d..22cae94244b62e067717d9a2cdf77b832ed07ef7 100644 (file)
@@ -48,12 +48,9 @@ bool GzipMethod::Fetch(FetchItem *Itm)
    // Open the source and destination files
    FileFd From(Path,FileFd::ReadOnlyGzip);
 
-   // if the file is empty, just rename it and return
-   if(From.Size() == 0) 
-   {
-      rename(Path.c_str(), Itm->DestFile.c_str());
-      return true;
-   }
+   // FIXME add an error message saying that empty files can't be valid archives
+   if(From.Size() == 0)
+      return false;
 
    FileFd To(Itm->DestFile,FileFd::WriteAtomic);   
    To.EraseOnFailure();