diff lib/protocols.c @ 817:cfa4ec2fb98f

2006-9-26 Brian Masney <masneyb@gftp.org> * lib/protocols.c (gftp_fd_read, gftp_fd_write) - make sure the return value properly matches what was actually read or written to the socket
author masneyb
date Tue, 26 Sep 2006 11:26:31 +0000
parents 11159114bb97
children b282e346bd25
line wrap: on
line diff
--- a/lib/protocols.c	Tue Sep 26 10:56:33 2006 +0000
+++ b/lib/protocols.c	Tue Sep 26 11:26:31 2006 +0000
@@ -2662,6 +2662,7 @@
   struct timeval tv;
   fd_set fset;
   ssize_t ret;
+  int s_ret;
 
   g_return_val_if_fail (fd >= 0, GFTP_EFATAL);
 
@@ -2676,8 +2677,8 @@
       FD_SET (fd, &fset);
       tv.tv_sec = network_timeout;
       tv.tv_usec = 0;
-      ret = select (fd + 1, &fset, NULL, NULL, &tv);
-      if (ret == -1 && (errno == EINTR || errno == EAGAIN))
+      s_ret = select (fd + 1, &fset, NULL, NULL, &tv);
+      if (s_ret == -1 && (errno == EINTR || errno == EAGAIN))
         {
           if (request != NULL && request->cancel)
             {
@@ -2687,7 +2688,7 @@
 
           continue;
         }
-      else if (ret <= 0)
+      else if (s_ret <= 0)
         {
           if (request != NULL)
             {
@@ -2737,9 +2738,9 @@
 {
   intptr_t network_timeout;
   struct timeval tv;
+  int ret, s_ret;
   ssize_t w_ret;
   fd_set fset;
-  int ret;
 
   g_return_val_if_fail (fd >= 0, GFTP_EFATAL);
 
@@ -2753,8 +2754,8 @@
       FD_SET (fd, &fset);
       tv.tv_sec = network_timeout;
       tv.tv_usec = 0;
-      ret = select (fd + 1, NULL, &fset, NULL, &tv);
-      if (ret == -1 && (errno == EINTR || errno == EAGAIN))
+      s_ret = select (fd + 1, NULL, &fset, NULL, &tv);
+      if (s_ret == -1 && (errno == EINTR || errno == EAGAIN))
         {
           if (request != NULL && request->cancel)
             {
@@ -2764,7 +2765,7 @@
 
           continue;
         }
-      else if (ret <= 0)
+      else if (s_ret <= 0)
         {
           if (request != NULL)
             {