From cf1cdb3328dacde829db8bbb3db4f5373ac07d61 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 6 Sep 2010 12:17:15 +0200 Subject: * methods/{gzip,bzip2}.cc: - empty files can never be valid archives (Closes: #595691) --- methods/gzip.cc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'methods/gzip.cc') diff --git a/methods/gzip.cc b/methods/gzip.cc index 5b9b66b50..22cae9424 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(); -- cgit v1.2.3-70-g09d2