]> git.saurik.com Git - apt.git/commitdiff
BufferedWriter: flushing: Check for written < size instead of <=
authorJulian Andres Klode <jak@debian.org>
Mon, 28 Dec 2015 03:09:55 +0000 (04:09 +0100)
committerJulian Andres Klode <jak@debian.org>
Mon, 28 Dec 2015 03:10:37 +0000 (04:10 +0100)
This avoids some issues with InternalWrite returning 0 because
it just cannot write stuff at the moment.

apt-pkg/contrib/fileutl.cc

index 71dfc83a21045161c5a765ae1a50535b75ab89a5..0c5d76290ed5d9c26803cb3d7f9b0a5889f61ddd 100644 (file)
@@ -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;
       }