summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/contrib/fileutl.cc12
1 files changed, 3 insertions, 9 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 004df3fe8..d95748aa6 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -1260,16 +1260,10 @@ public:
}
virtual ssize_t InternalWrite(void const * const From, unsigned long long const Size) override
{
- size_t written = 0;
+ auto written = writebuffer.write(From, Size);
- while (written < Size) {
- auto buffered = writebuffer.write(static_cast<char const*>(From) + written, Size - written);
-
- written += buffered;
-
- if (writebuffer.full() && InternalFlush() == false)
- return -1;
- }
+ if (writebuffer.full() && InternalFlush() == false)
+ return -1;
return written;
}