summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/fileutl.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-04-15 10:21:52 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2014-04-16 17:04:17 +0200
commitbb93178b8b5c2f8021977dbc34066f0d0fb8b9b9 (patch)
tree41982ad9b30b06242357a55a84813cf3b4bee0f1 /apt-pkg/contrib/fileutl.cc
parent76bd63e2dc6ac5aaaf7f2cc98c2a83ab88ccc46c (diff)
clear HitEof flag in FileFd::Seek
fseek and co do this to their eof-flags and it is more logic this way as we will usually seek away from the end (e.g. to re-read the file). The commit also improves the testcase further and adds a test for the binary compressor codepath (as gz, bzip2 and xz are handled by libraries) via the use of 'rev' as a 'compressor'.
Diffstat (limited to 'apt-pkg/contrib/fileutl.cc')
-rw-r--r--apt-pkg/contrib/fileutl.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index c9d419fc4..de73a7fd8 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -1360,7 +1360,10 @@ bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::C
Args.push_back(a->c_str());
if (Comp == false && FileName.empty() == false)
{
- Args.push_back("--stdout");
+ // commands not needing arguments, do not need to be told about using standard output
+ // in reality, only testcases with tools like cat, rev, rot13, … are able to trigger this
+ if (compressor.CompressArgs.empty() == false && compressor.UncompressArgs.empty() == false)
+ Args.push_back("--stdout");
if (TemporaryFileName.empty() == false)
Args.push_back(TemporaryFileName.c_str());
else
@@ -1653,6 +1656,8 @@ bool FileFd::Write(int Fd, const void *From, unsigned long long Size)
/* */
bool FileFd::Seek(unsigned long long To)
{
+ Flags &= ~HitEof;
+
if (d != NULL && (d->pipe == true || d->InternalStream() == true))
{
// Our poor man seeking in pipes is costly, so try to avoid it