accept() returns a file descriptor when it succeeds which is very

likely to be non-zero.  When leaving the cancellation point, check
the return value against -1 to see if cancellation should be
checked.  While I'm here, make the same change to connect() just
to be consisitent.

Pointed out by: davidxu
This commit is contained in:
Daniel Eischen 2003-12-09 23:40:27 +00:00
parent 67ba867827
commit 6ed6ccb310
4 changed files with 4 additions and 4 deletions

View File

@ -43,7 +43,7 @@ __accept(int s, struct sockaddr *addr, socklen_t *addrlen)
curthread = _get_curthread();
_thr_cancel_enter(curthread);
ret = __sys_accept(s, addr, addrlen);
_thr_cancel_leave(curthread, ret != 0);
_thr_cancel_leave(curthread, ret == -1);
return (ret);
}

View File

@ -43,7 +43,7 @@ __connect(int fd, const struct sockaddr *name, socklen_t namelen)
curthread = _get_curthread();
_thr_cancel_enter(curthread);
ret = __sys_connect(fd, name, namelen);
_thr_cancel_leave(curthread, ret != 0);
_thr_cancel_leave(curthread, ret == -1);
return (ret);
}

View File

@ -43,7 +43,7 @@ __accept(int s, struct sockaddr *addr, socklen_t *addrlen)
curthread = _get_curthread();
_thr_cancel_enter(curthread);
ret = __sys_accept(s, addr, addrlen);
_thr_cancel_leave(curthread, ret != 0);
_thr_cancel_leave(curthread, ret == -1);
return (ret);
}

View File

@ -43,7 +43,7 @@ __connect(int fd, const struct sockaddr *name, socklen_t namelen)
curthread = _get_curthread();
_thr_cancel_enter(curthread);
ret = __sys_connect(fd, name, namelen);
_thr_cancel_leave(curthread, ret != 0);
_thr_cancel_leave(curthread, ret == -1);
return (ret);
}