X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/2a679f4f71784800b6643b5c4eecb4b11865a439..1054d76b2519efc858a9d23301495a763c1f8230:/methods/gzip.cc diff --git a/methods/gzip.cc b/methods/gzip.cc index 72e3ac909..22cae9424 100644 --- a/methods/gzip.cc +++ b/methods/gzip.cc @@ -48,14 +48,11 @@ 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::WriteEmpty); + FileFd To(Itm->DestFile,FileFd::WriteAtomic); To.EraseOnFailure(); if (_error->PendingError() == true) return false;