Explorar o código

EAGAIN patch from 1.8 branch was not applied to HEAD.

Adam Heath %!s(int64=25) %!d(string=hai) anos
pai
achega
d7e51ca0a5
Modificáronse 2 ficheiros con 7 adicións e 3 borrados
  1. 4 0
      ChangeLog
  2. 3 3
      lib/mlib.c

+ 4 - 0
ChangeLog

@@ -1,3 +1,7 @@
+Mon Apr 30 10:04:36 CDT 2001 Adam Heath <doogie@debian.org>
+
+  * lib/mlib.c: EAGAIN patch from 1.8 branch was not applied to HEAD.
+
 Sun Apr 29 22:39:55 CDT 2001 Adam Heath <doogie@debian.org>
 
   * lib/database.c, lib/fields.c: Fix Eterm/eterm problem.  findpackage()

+ 3 - 3
lib/mlib.c

@@ -294,10 +294,10 @@ ssize_t buffer_copy(buffer_data_t read_data, buffer_data_t write_data, ssize_t l
   writebuf= buf= malloc(bufsize);
   if(buf== NULL) ohshite(_("failed to allocate buffer in buffer_copy (%s)"), desc);
 
-  while(bytesread >= 0 && byteswritten >= 0) {
+  while(bytesread >= 0 && byteswritten >= 0 && bufsize > 0) {
     bytesread= read_data->proc(read_data, buf, bufsize, desc);
     if (bytesread<0) {
-      if (errno==EINTR) continue;
+      if (errno==EINTR || errno==EAGAIN) continue;
       break;
     }
     if (bytesread==0)
@@ -313,7 +313,7 @@ ssize_t buffer_copy(buffer_data_t read_data, buffer_data_t write_data, ssize_t l
     while(bytesread) {
       byteswritten= write_data->proc(write_data, writebuf, bytesread, desc);
       if(byteswritten == -1) {
-	if(errno == EINTR) continue;
+	if(errno == EINTR || errno==EAGAIN) continue;
 	break;
       }
       if(byteswritten==0)