[426] in Pthreads mailing list archive
Fix for connect()
daemon@ATHENA.MIT.EDU (Larry V. Streepy, Jr.)
Fri Sep 27 15:03:36 1996
Date: Fri, 27 Sep 1996 12:44:37 -0600
From: "Larry V. Streepy, Jr." <streepy@healthcare.com>
To: pthreads@MIT.EDU
This is a multi-part message in MIME format.
--------------9D916E540863B9C1684815A
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Attached is a fix for connect(). It was failing to properly set errno
and return -1 when the connect failed.
--
Larry V. Streepy, Jr.
Chief Technical Officer, Healthcare Communications, Inc.
mailto:streepy@healthcare.com
(214) 851-7033 (Dallas Main #)
(970) 626-5028 (My office #) (970) 626-4425 (Fax)
--------------9D916E540863B9C1684815A
Content-Type: text/plain; charset=us-ascii; name="diff.out"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="diff.out"
*** ../../pthreads-1_60_beta5.old/pthreads/fd_kern.c Sun Feb 11 17:58:30 1996
--- ./fd_kern.c Fri Sep 27 12:07:09 1996
***************
*** 128,134 ****
if ((count = machdep_sys_select(dtablesize, &fd_set_read,
! &fd_set_write, NULL, &__fd_kern_poll_timeout)) < OK) {
if (count == -EINTR) {
return;
}
--- 128,134 ----
if ((count = machdep_sys_select(dtablesize, &fd_set_read,
! &fd_set_write, &fd_set_except, &__fd_kern_poll_timeout)) < OK) {
if (count == -EINTR) {
return;
}
***************
*** 266,272 ****
*/
while ((count = machdep_sys_select(dtablesize, &fd_set_read,
! &fd_set_write, NULL, &__fd_kern_wait_timeout)) < OK) {
if (count == -EINTR) {
return;
}
--- 266,272 ----
*/
while ((count = machdep_sys_select(dtablesize, &fd_set_read,
! &fd_set_write, &fd_set_except, &__fd_kern_wait_timeout)) < OK) {
if (count == -EINTR) {
return;
}
***************
*** 1121,1131 ****
tmpnamelen = sizeof(tmpname);
/* OK now lets see if it really worked */
if (((ret = machdep_sys_getpeername(fd_table[fd]->fd.i,
! &tmpname, &tmpnamelen)) < OK) && (ret == -ENOTCONN)) {
/* Get the error, this function should not fail */
machdep_sys_getsockopt(fd_table[fd]->fd.i, SOL_SOCKET,
! SO_ERROR, &pthread_run->error, &tmpnamelen);
}
} else {
SET_ERRNO(-ret);
--- 1121,1134 ----
tmpnamelen = sizeof(tmpname);
/* OK now lets see if it really worked */
if (((ret = machdep_sys_getpeername(fd_table[fd]->fd.i,
! &tmpname, &tmpnamelen)) < OK)
! && (ret == -ENOTCONN)) {
/* Get the error, this function should not fail */
machdep_sys_getsockopt(fd_table[fd]->fd.i, SOL_SOCKET,
! SO_ERROR, &ret, &tmpnamelen);
! SET_ERRNO(-ret);
! ret = NOTOK;
}
} else {
SET_ERRNO(-ret);
--------------9D916E540863B9C1684815A--