diff options
Diffstat (limited to 'pr/src/pthreads/ptio.c')
-rw-r--r-- | pr/src/pthreads/ptio.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/pr/src/pthreads/ptio.c b/pr/src/pthreads/ptio.c index 7a4ce96f..a7ba5970 100644 --- a/pr/src/pthreads/ptio.c +++ b/pr/src/pthreads/ptio.c @@ -1071,6 +1071,15 @@ static PRBool pt_solaris_sendfile_cont(pt_Continuation *op, PRInt16 revents) return PR_TRUE; } count = xferred; + } else if (count == 0) { + /* + * We are now at EOF. The file was truncated. Solaris sendfile is + * supposed to return 0 and no error in this case, though some versions + * may return -1 and EINVAL . + */ + op->result.code = -1; + op->syserrno = 0; /* will be treated as EOF */ + return PR_TRUE; } PR_ASSERT(count <= op->nbytes_to_send); @@ -2419,6 +2428,14 @@ static PRInt32 pt_SolarisSendFile(PRFileDesc *sd, PRSendFileData *sfd, || syserrno == EAGAIN || syserrno == EWOULDBLOCK) { count = xferred; } + } else if (count == 0) { + /* + * We are now at EOF. The file was truncated. Solaris sendfile is + * supposed to return 0 and no error in this case, though some versions + * may return -1 and EINVAL . + */ + count = -1; + syserrno = 0; /* will be treated as EOF */ } if (count != -1 && count < nbytes_to_send) { @@ -3463,7 +3480,7 @@ PR_IMPLEMENT(PRFileDesc*) PR_Socket(PRInt32 domain, PRInt32 type, PRInt32 proto) fd = pt_SetMethods(osfd, ftype, PR_FALSE, PR_FALSE); if (fd == NULL) close(osfd); } -#ifdef _PR_STRICT_ADDR_LEN +#ifdef _PR_NEED_SECRET_AF if (fd != NULL) fd->secret->af = domain; #endif #if defined(_PR_INET6_PROBE) || !defined(_PR_INET6) @@ -4451,7 +4468,7 @@ PR_IMPLEMENT(PRFileDesc*) PR_ImportTCPSocket(PRInt32 osfd) if (!_pr_initialized) _PR_ImplicitInitialization(); fd = pt_SetMethods(osfd, PR_DESC_SOCKET_TCP, PR_FALSE, PR_TRUE); if (NULL == fd) close(osfd); -#ifdef _PR_STRICT_ADDR_LEN +#ifdef _PR_NEED_SECRET_AF if (NULL != fd) fd->secret->af = PF_INET; #endif return fd; @@ -4583,7 +4600,7 @@ PR_IMPLEMENT(PRStatus) PR_UnlockFile(PRFileDesc *fd) * defined here for historical (or hysterical) reasons. */ -PRInt32 PR_GetSysfdTableMax(void) +PR_IMPLEMENT(PRInt32) PR_GetSysfdTableMax(void) { #if defined(XP_UNIX) && !defined(AIX) && !defined(VMS) struct rlimit rlim; @@ -4597,7 +4614,7 @@ PRInt32 PR_GetSysfdTableMax(void) #endif } -PRInt32 PR_SetSysfdTableSize(PRIntn table_size) +PR_IMPLEMENT(PRInt32) PR_SetSysfdTableSize(PRIntn table_size) { #if defined(XP_UNIX) && !defined(AIX) && !defined(VMS) struct rlimit rlim; |