X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/22041bd2864b8d0b401b45dde9eda4003a11fec4..f7f0d6c7560a8f71707e7852a512469147aa9f84:/methods/bzip2.cc diff --git a/methods/bzip2.cc b/methods/bzip2.cc index 19e49828e..42932dded 100644 --- a/methods/bzip2.cc +++ b/methods/bzip2.cc @@ -56,12 +56,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) @@ -102,9 +98,8 @@ bool Bzip2Method::Fetch(FetchItem *Itm) while (1) { unsigned char Buffer[4*1024]; - unsigned long Count; - Count = read(GzOut[0],Buffer,sizeof(Buffer)); + ssize_t Count = read(GzOut[0],Buffer,sizeof(Buffer)); if (Count < 0 && errno == EINTR) continue;