From 80f06991967d4daccb1c0c1147a6e16291ebb027 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 28 Dec 2015 04:09:55 +0100 Subject: BufferedWriter: flushing: Check for written < size instead of <= This avoids some issues with InternalWrite returning 0 because it just cannot write stuff at the moment. --- apt-pkg/contrib/fileutl.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'apt-pkg/contrib/fileutl.cc') diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 71dfc83a2..0c5d76290 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -1222,12 +1222,10 @@ public: char *data = writebuffer.get(); auto size = writebuffer.size(); - while (written <= size) { + while (written < size) { auto written_this_time = wrapped->InternalWrite(data + written, size - written); if (written_this_time < 0) return false; - if (written_this_time == 0) - break; written += written_this_time; } -- cgit v1.2.3