X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/b3d44315ee812ba2d0a99751695b5a4314407ec2..0da8987ab9e67ad693e38bb5cfe692f12b1a7db9:/methods/gzip.cc diff --git a/methods/gzip.cc b/methods/gzip.cc index 809afc0fc..f732c0b86 100644 --- a/methods/gzip.cc +++ b/methods/gzip.cc @@ -52,6 +52,13 @@ bool GzipMethod::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; + } + int GzOut[2]; if (pipe(GzOut) < 0) return _error->Errno("pipe",_("Couldn't open pipe for %s"),Prog); @@ -111,6 +118,7 @@ bool GzipMethod::Fetch(FetchItem *Itm) if (To.Write(Buffer,Count) == false) { Failed = true; + FromGz.Close(); break; } }