ExtractTar: Allow an empty decompressor program
authorGuillem Jover <guillem@debian.org>
Sun, 16 Feb 2014 22:29:13 +0000 (23:29 +0100)
committerMichael Vogt <mvo@debian.org>
Sat, 22 Feb 2014 19:06:41 +0000 (20:06 +0100)
This allows for uncompressed tar files, as the decompressor process will
not get interposed in-between the file descriptors.

apt-inst/contrib/extracttar.cc

index 2437c97..41301d1 100644 (file)
@@ -111,6 +111,12 @@ bool ExtractTar::Done(bool Force)
    gzip will efficiently ignore the extra bits. */
 bool ExtractTar::StartGzip()
 {
+   if (DecompressProg.empty())
+   {
+      InFd.OpenDescriptor(File.Fd(), FileFd::ReadOnly, FileFd::None, false);
+      return true;
+   }
+
    int Pipes[2];
    if (pipe(Pipes) != 0)
       return _error->Errno("pipe",_("Failed to create pipes"));