50 lines
1.2 KiB
Text
50 lines
1.2 KiB
Text
$NetBSD: patch-ab,v 1.2 2002/10/23 21:12:37 bouyer Exp $
|
|
|
|
--- vncviewer/sockets.c.orig Wed Oct 23 20:17:57 2002
|
|
+++ vncviewer/sockets.c Wed Oct 23 20:23:48 2002
|
|
@@ -210,7 +210,11 @@
|
|
return -1;
|
|
}
|
|
|
|
+#ifdef SVR4
|
|
+ if (connect(sock, sa, sizeof(struct sockaddr_in)) < 0) {
|
|
+#else
|
|
if (connect(sock, sa, sa->sa_len) < 0) {
|
|
+#endif
|
|
fprintf(stderr,programName);
|
|
perror(": ConnectToTcpAddr: connect");
|
|
close(sock);
|
|
@@ -369,26 +373,27 @@
|
|
#else
|
|
/* just for IPv4 */
|
|
struct hostent *hp;
|
|
- struct sockaddr_in *sin;
|
|
+ struct sockaddr_in *sin = (struct sockaddr_in *)sa;
|
|
struct in_addr *addr = &sin->sin_addr;
|
|
|
|
- sin = (struct sockaddr_in *)sa;
|
|
sin->sin_family = AF_INET;
|
|
+#ifndef SVR4
|
|
sin->sin_len = sizeof(struct sockaddr_in);
|
|
+#endif
|
|
sin->sin_port = 0;
|
|
|
|
if (strcmp(str,"") == 0) {
|
|
- *addr = 0; /* local */
|
|
+ memset(addr, 0, sizeof(struct sockaddr_in)); /* local */
|
|
return True;
|
|
}
|
|
|
|
- if ((addr.s_addr = inet_addr(str)) == -1) {
|
|
+ if ((addr->s_addr = inet_addr(str)) == -1) {
|
|
if (!(hp = gethostbyname(str)))
|
|
return False;
|
|
- memcpy(&addr, hp->h_addr, sizeof(struct in_addr));
|
|
+ memcpy(addr, hp->h_addr, sizeof(struct in_addr));
|
|
}
|
|
|
|
- return False;
|
|
+ return True;
|
|
#endif
|
|
}
|
|
|