Merged the fixes for bug 136251 and bug 135119 on the NSPRPUB_PRE_4_2_CLIENT_BRANCH
authorwtc%netscape.com
Thu, 11 Apr 2002 21:46:14 +0000
branchNSPRPUB_PRE_4_2_CLIENT_BRANCH
changeset 2339 d47fbb5e9c6739c0b6a7ace5b2813b75f1e272b6
parent 2320 4f7c8ee2fe9067e71e52c4ae6e90963716f4e270
child 2340 d6a2f8fb432fc1fe596469e5582cf4e8829610f9
push idunknown
push userunknown
push dateunknown
bugs136251, 135119
Merged the fixes for bug 136251 and bug 135119 on the NSPRPUB_PRE_4_2_CLIENT_BRANCH.
pr/src/pthreads/ptio.c
--- a/pr/src/pthreads/ptio.c
+++ b/pr/src/pthreads/ptio.c
@@ -174,26 +174,23 @@ static ssize_t (*pt_aix_sendfile_fptr)()
 #endif /* AIX */
 
 #ifdef LINUX
 #include <sys/sendfile.h>
 #endif
 
 #include "primpl.h"
 
-/* On Alpha Linux, these are already defined in sys/socket.h */
-#if !(defined(LINUX) && defined(__alpha))
 #include <netinet/tcp.h>  /* TCP_NODELAY, TCP_MAXSEG */
 #ifdef LINUX
 /* TCP_CORK is not defined in <netinet/tcp.h> on Red Hat Linux 6.0 */
 #ifndef TCP_CORK
 #define TCP_CORK 3
 #endif
 #endif
-#endif
 
 #if defined(SOLARIS)
 #define _PRSockOptVal_t char *
 #elif defined(IRIX) || defined(OSF1) || defined(AIX) || defined(HPUX) \
     || defined(LINUX) || defined(FREEBSD) || defined(BSDI) || defined(VMS) \
     || defined(NTO) || defined(OPENBSD) || defined(DARWIN) \
     || defined(UNIXWARE)
 #define _PRSockOptVal_t void *
@@ -286,21 +283,19 @@ static PRBool IsValidNetAddrLen(const PR
 /*
  * pt_SockLen is the type for the length of a socket address
  * structure, used in the address length argument to bind,
  * connect, accept, getsockname, getpeername, etc.  Posix.1g
  * defines this type as socklen_t.  It is size_t or int on
  * most current systems.
  */
 #if defined(HAVE_SOCKLEN_T) \
-    || (defined(LINUX) && defined(__GLIBC__) && __GLIBC__ >= 2 \
-    && !defined(__alpha))
+    || (defined(LINUX) && defined(__GLIBC__) && __GLIBC__ >= 2)
 typedef socklen_t pt_SockLen;
 #elif (defined(AIX) && !defined(AIX4_1)) \
-    || (defined(LINUX) && defined(__alpha)) \
     || defined(VMS)
 typedef PRSize pt_SockLen;
 #else
 typedef PRIntn pt_SockLen;
 #endif
 
 typedef struct pt_Continuation pt_Continuation;
 typedef PRBool (*ContinuationFn)(pt_Continuation *op, PRInt16 revents);
@@ -1055,28 +1050,28 @@ static PRBool pt_hpux_sendfile_cont(pt_C
 #ifdef SOLARIS  
 static PRBool pt_solaris_sendfile_cont(pt_Continuation *op, PRInt16 revents)
 {
     struct sendfilevec *vec = (struct sendfilevec *) op->arg2.buffer;
     size_t xferred;
     ssize_t count;
 
     count = SOLARIS_SENDFILEV(op->arg1.osfd, vec, op->arg3.amount, &xferred);
+    op->syserrno = errno;
     PR_ASSERT((count == -1) || (count == xferred));
-    PR_ASSERT(xferred <= op->nbytes_to_send);
-    op->syserrno = errno;
 
     if (count == -1) {
         if (op->syserrno != EWOULDBLOCK && op->syserrno != EAGAIN
                 && op->syserrno != EINTR) {
             op->result.code = -1;
             return PR_TRUE;
         }
         count = xferred;
     }
+    PR_ASSERT(count <= op->nbytes_to_send);
     
     op->result.code += count;
     if (count < op->nbytes_to_send) {
         op->nbytes_to_send -= count;
 
         while (count >= vec->sfv_len) {
             count -= vec->sfv_len;
             vec++;