[patch] RealVNC 4.0b4 (Xvnc): fix vncconfig -connect
Tim Waugh
twaugh "at" redhat.com
Fri Jan 23 17:30:00 2004
See: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=114063
While attempting a reverse connection from the VNC module in the
XFree86 server to the vncviewer client, it is very likely that a
SIGALRM will interrupt the connect() system call.
Unfortunately, the existing code treats this as a failure, rather than
a reason to try again. Here is the fix:
--- vnc-4.0b4-unixsrc/network/TcpSocket.cxx.restart 2004-01-22 15:24:34.000000000 +0000
+++ vnc-4.0b4-unixsrc/network/TcpSocket.cxx 2004-01-22 15:27:22.000000000 +0000
@@ -131,10 +131,14 @@
}
// Attempt to connect to the remote host
- if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) != 0) {
- int e = errorNumber;
- closesocket(sock);
- throw SocketException("unable to connect to host", e);
+ for (;;) {
+ if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) != 0) {
+ int e = errorNumber;
+ if (e == EINTR)
+ continue;
+ closesocket(sock);
+ throw SocketException("unable to connect to host", e);
+ } else break;
}
int one = 1;
Tim.
*/