summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2010-09-06 12:17:15 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2010-09-06 12:17:15 +0200
commitcf1cdb3328dacde829db8bbb3db4f5373ac07d61 (patch)
tree7287684652af4da2c05bf6259a1d65afed17ef90
parent1f8b2599f6beb14e8855f5d43fc1a759a08690e9 (diff)
downloadapt-cf1cdb3328dacde829db8bbb3db4f5373ac07d61.tar.gz
* methods/{gzip,bzip2}.cc:
- empty files can never be valid archives (Closes: #595691)
-rw-r--r--debian/changelog4
-rw-r--r--methods/bzip2.cc9
-rw-r--r--methods/gzip.cc9
3 files changed, 9 insertions, 13 deletions
diff --git a/debian/changelog b/debian/changelog
index 4dca6260..07196db2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -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
diff --git a/methods/bzip2.cc b/methods/bzip2.cc
index 241f21c6..c668141a 100644
--- a/methods/bzip2.cc
+++ b/methods/bzip2.cc
@@ -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)
diff --git a/methods/gzip.cc b/methods/gzip.cc
index 5b9b66b5..22cae942 100644
--- a/methods/gzip.cc
+++ b/methods/gzip.cc
@@ -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();