Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Commit time: 2007-01-16 02:32:08 UTC

Modified files:
     ChangeLog ircd/os_generic.c

Log message:

Make os_recv_nonb() return with errno==0 on EOF.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.829 ircu2.10/ChangeLog:1.830
--- ircu2.10/ChangeLog:1.829    Sun Dec 31 11:39:28 2006
+++ ircu2.10/ChangeLog  Mon Jan 15 18:31:57 2007
@@ -1,3 +1,8 @@
+2006-01-14  Michael Poole <[EMAIL PROTECTED]>
+
+       * ircd/os_generic.c (os_recv_nonb): Set errno to zero when
+       returning IO_FAILURE due to a closed connection.
+
 2006-12-31  Michael Poole <[EMAIL PROTECTED]>
 
        * ircd/s_user.c (set_nick_name): Only use actual account name in
Index: ircu2.10/ircd/os_generic.c
diff -u ircu2.10/ircd/os_generic.c:1.28 ircu2.10/ircd/os_generic.c:1.29
--- ircu2.10/ircd/os_generic.c:1.28     Thu Dec  7 17:39:22 2006
+++ ircu2.10/ircd/os_generic.c  Mon Jan 15 18:31:58 2007
@@ -18,7 +18,7 @@
  */
 /** @file
  * @brief Implementation of OS-dependent operations.
- * @version $Id: os_generic.c,v 1.28 2006/12/08 01:39:22 entrope Exp $
+ * @version $Id: os_generic.c,v 1.29 2007/01/16 02:31:58 entrope Exp $
  */
 #include "config.h"
 
@@ -456,9 +456,13 @@
   if (0 < (res = recv(fd, buf, length, 0))) {
     *count_out = (unsigned) res;
     return IO_SUCCESS;
+  } else if (res == 0) {
+    *count_out = 0;
+    errno = 0; /* or ECONNRESET? */
+    return IO_FAILURE;
   } else {
     *count_out = 0;
-    return (res < 0) && is_blocked(errno) ? IO_BLOCKED : IO_FAILURE;
+    return is_blocked(errno) ? IO_BLOCKED : IO_FAILURE;
   }
 }
 
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to