OSSP CVS Repository

ossp - Difference in ossp-pkg/sa/sa.c versions 1.18 and 1.19
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/sa/sa.c 1.18 -> 1.19

--- sa.c 2001/10/09 18:26:12     1.18
+++ sa.c 2001/10/09 18:34:12     1.19
@@ -1134,7 +1134,7 @@
             goto done;
         }
         else if (n == 0) {
-            error = ETIMEDOUT;
+            rv = SA_ERR_TMT;
             goto done;
         }
 
@@ -1216,7 +1216,7 @@
                              &sa->tvTimeout[SA_TIMEOUT_ACCEPT]);
         } while (n == -1 && errno == EINTR);
         if (n == 0) 
-            errno = ETIMEDOUT;
+            return SA_ERR_TMT;
         if (n <= 0)
             return SA_ERR_SYS;
     }
@@ -1413,6 +1413,8 @@
         res = sa_read_raw(sa, cpBuf, nBufReq);
         if (res == 0)
             rv = SA_ERR_EOF;
+        else if (res < 0 && errno == ETIMEDOUT)
+            rv = SA_ERR_TMT;
         else if (res < 0)
             rv = SA_ERR_SYS;
     }
@@ -1443,13 +1445,18 @@
                         res += n;
                     else if (n == 0)
                         rv = (res == 0 ? SA_ERR_EOF : SA_OK);
+                    else if (n < 0 && errno == ETIMEDOUT)
+                        rv = (res == 0 ? SA_ERR_TMT : SA_OK);
                     else if (n < 0)
                         rv = (res == 0 ? SA_ERR_SYS : SA_OK);
                 }
                 else {
                     /* fill buffer with new data */
                     n = sa_read_raw(sa, sa->cpReadBuf, sa->nReadSize);
-                    if (n < 0)
+                    if (n < 0 && errno == ETIMEDOUT)
+                        /* timeout on this read, but perhaps ok as a whole */
+                        rv = (res == 0 ? SA_ERR_TMT : SA_OK);
+                    else if (n < 0)
                         /* error on this read, but perhaps ok as a whole */
                         rv = (res == 0 ? SA_ERR_SYS : SA_OK);
                     if (n == 0)
@@ -1565,7 +1572,9 @@
     if (sa->nWriteSize == 0) {
         /* user-space unbuffered I/O */
         res = sa_write_raw(sa, cpBuf, nBufReq);
-        if (res < 0)
+        if (res < 0 && errno == ETIMEDOUT)
+            rv = SA_ERR_TMT;
+        else if (res < 0)
             rv = SA_ERR_SYS;
     }
     else {
@@ -1579,7 +1588,9 @@
             /* buffer too small at all, so write immediately */
             while (nBufReq > 0) {
                 n = sa_write_raw(sa, cpBuf, nBufReq);
-                if (n < 0)
+                if (n < 0 && errno == ETIMEDOUT)
+                    rv = (res == 0 ? SA_ERR_TMT : SA_OK);
+                else if (n < 0)
                     rv = (res == 0 ? SA_ERR_SYS : SA_OK);
                 if (n <= 0)
                     break;
@@ -1657,7 +1668,9 @@
     if (sa->nWriteSize > 0) {
         while (sa->nWriteLen > 0) {
             n = sa_write_raw(sa, sa->cpWriteBuf, sa->nWriteLen);
-            if (n < 0)
+            if (n < 0 && errno == ETIMEDOUT)
+                rv = SA_ERR_TMT;
+            else if (n < 0)
                 rv = SA_ERR_SYS;
             if (n <= 0)
                 break;

CVSTrac 2.0.1