From: Julian Andres Klode Date: Mon, 28 Dec 2015 03:09:55 +0000 (+0100) Subject: BufferedWriter: flushing: Check for written < size instead of <= X-Git-Tag: 1.1.10~12 X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/80f06991967d4daccb1c0c1147a6e16291ebb027 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. --- 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; }