summaryrefslogtreecommitdiff
path: root/methods/gzip.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2006-12-14 12:07:24 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2006-12-14 12:07:24 +0100
commitdc4002d8c3c687e6614d01b34e4b6aa929411ea9 (patch)
tree8a842af457cfb159741b6c84ee7ab6fc094b88e7 /methods/gzip.cc
parent7570b65d5eae54c51689121a317351a1cd42e64d (diff)
parent19ec5723caa6ea6ab196a9e960c769ded4ee0d28 (diff)
* merged with apt--mvo
Diffstat (limited to 'methods/gzip.cc')
-rw-r--r--methods/gzip.cc8
1 files changed, 8 insertions, 0 deletions
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;
}
}