summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/fileutl.cc
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2014-03-27 15:19:29 +0100
committerMichael Vogt <mvo@debian.org>2014-03-27 15:19:29 +0100
commit62f1ee1cc7a5e16ca0cbfbee3c00cefab1892f87 (patch)
tree811c93213ce371ea12384994615a6e98366221a0 /apt-pkg/contrib/fileutl.cc
parent8d50b63f28f0d68ca72b6dc6e50e09cfec9842be (diff)
parent21b3eac8f9ab8e12b43fa8998a5aa5465f29adc5 (diff)
Merge remote-tracking branch 'upstream/debian/sid' into debian/sid
Diffstat (limited to 'apt-pkg/contrib/fileutl.cc')
-rw-r--r--apt-pkg/contrib/fileutl.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 1eabf37f4..69406a9bf 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -1191,7 +1191,7 @@ bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::C
d->openmode = Mode;
d->compressor = compressor;
#if defined HAVE_ZLIB || defined HAVE_BZ2 || defined HAVE_LZMA
- if (AutoClose == false && compress_open != NULL)
+ if ((Flags & AutoClose) != AutoClose && compress_open != NULL)
{
// Need to duplicate fd here or gz/bz2 close for cleanup will close the fd as well
int const internFd = dup(iFd);
@@ -1430,7 +1430,15 @@ bool FileFd::Read(void *To,unsigned long long Size,unsigned long long *Actual)
errno = 0;
}
else
+ {
Res = Size - d->lzma->stream.avail_out;
+ if (Res == 0)
+ {
+ // lzma run was okay, but produced no output…
+ Res = -1;
+ errno = EINTR;
+ }
+ }
}
#endif
else
@@ -1439,7 +1447,12 @@ bool FileFd::Read(void *To,unsigned long long Size,unsigned long long *Actual)
if (Res < 0)
{
if (errno == EINTR)
+ {
+ // trick the while-loop into running again
+ Res = 1;
+ errno = 0;
continue;
+ }
if (false)
/* dummy so that the rest can be 'else if's */;
#ifdef HAVE_ZLIB