Przeglądaj źródła

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.
Julian Andres Klode 10 lat temu
rodzic
commit
80f0699196
1 zmienionych plików z 1 dodań i 3 usunięć
  1. 1 3
      apt-pkg/contrib/fileutl.cc

+ 1 - 3
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;
       }