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:
parent
67ba867827
commit
6ed6ccb310
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user