Index: ossp-pkg/sa/sa.c RCS File: /v/ossp/cvs/ossp-pkg/sa/sa.c,v rcsdiff -q -kk '-r1.81' '-r1.82' -u '/v/ossp/cvs/ossp-pkg/sa/sa.c,v' 2>/dev/null --- sa.c 2004/04/02 18:47:39 1.81 +++ sa.c 2004/04/02 18:49:42 1.82 @@ -1482,6 +1482,19 @@ /* perform the connect operation */ if ((n = SA_SC_CALL_3(sa, connect, sa->fdSocket, raddr->saBuf, raddr->slBuf)) < 0) { if (errno != EINTR && errno != EINPROGRESS) { + /* we have to perform the following post-processing under + EINPROGRESS anway, but actually also for EINTR according + to Unix Network Programming, volume 1, section 5.9, W. + Richard Stevens: "What we are doing [] is restarting + the interrupted system call ourself. This is fine for + accept, along with the functions such as read, write, + select and open. But there is one function that we cannot + restart ourself: connect. If this function returns EINTR, + we cannot call it again, as doing so will return an + immediate error. When connect is interrupted by a caught + signal and is not automatically restarted, we must call + select to wait for the connection to complete, as we + describe in section 15.3." */ error = errno; goto done; }