X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lib-src%2Fgnuslib.c;h=8951b265e8d7c5a45c4a4327c9ccf04ef0971bfc;hb=ef136db284dffac68f25bb0c170f8ef90c0af387;hp=9022d4854be7cdf4fe2bcddc2393103b306dd5b2;hpb=716cfba952c1dc0d2cf5c968971f3780ba728a89;p=chise%2Fxemacs-chise.git.1 diff --git a/lib-src/gnuslib.c b/lib-src/gnuslib.c index 9022d48..8951b26 100644 --- a/lib-src/gnuslib.c +++ b/lib-src/gnuslib.c @@ -43,7 +43,7 @@ static int connect_to_ipc_server (void); static int connect_to_unix_server (void); #endif #ifdef INTERNET_DOMAIN_SOCKETS -static int connect_to_internet_server (char *serverhost, u_short port); +static int connect_to_internet_server (char *serverhost, unsigned short port); #endif /* On some systems, e.g. DGUX, inet_addr returns a 'struct in_addr'. */ @@ -194,7 +194,7 @@ disconnect_from_ipc_server (int s, struct msgbuf *msgp, int echo) send_string -- send string to socket. */ void -send_string (int s, CONST char *msg) +send_string (int s, const char *msg) { #if 0 if (send(s,msg,strlen(msg),0) < 0) { @@ -313,13 +313,15 @@ static Xauth *server_xauth = NULL; descriptor for server if successful. */ static int -connect_to_internet_server (char *serverhost, u_short port) +connect_to_internet_server (char *serverhost, unsigned short port) { int s; /* connected socket descriptor */ struct servent *sp; /* pointer to service information */ struct sockaddr_in peeraddr_in; /* for peer socket address */ char buf[512]; /* temporary buffer */ + int t; + /* clear out address structures */ memset((char *)&peeraddr_in,0,sizeof(struct sockaddr_in)); @@ -327,10 +329,12 @@ connect_to_internet_server (char *serverhost, u_short port) peeraddr_in.sin_family = AF_INET; /* look up the server host's internet address */ - if ((peeraddr_in.sin_addr.s_addr = internet_addr(serverhost)) == -1) { + if ((t = internet_addr(serverhost)) == -1) { fprintf(stderr,"%s: unable to find %s in /etc/hosts or from YP\n", progname,serverhost); exit(1); + } else { + peeraddr_in.sin_addr.s_addr = t; }; /* if */ if (port == 0) { @@ -407,13 +411,11 @@ disconnect_from_server (int s, int echo) send_string(s,EOT_STR); /* make sure server gets string */ -#if !defined (linux) && !defined (_SCO_DS) +#if !defined (_SCO_DS) /* - * shutdown is completely hozed under linux. If s is a unix domain socket, - * you'll get EOPNOTSUPP back from it. If s is an internet socket, you get - * a broken pipe when you try to read a bit later. The latter - * problem is fixed for linux versions >= 1.1.46, but the problem - * with unix sockets persists. Sigh. + * There used to be a comment here complaining about ancient Linux + * versions. It is no longer relevant. I don't know why _SCO_DS is + * verboten here, as the original comment did not say. */ if (shutdown(s,1) == -1) { @@ -432,7 +434,7 @@ disconnect_from_server (int s, int echo) #else while ((length = read(s,buffer,GSERV_BUFSZ)) > 0 || (length == -1 && errno == EINTR)) { - if (length) { + if (length > 0) { buffer[length] = '\0'; if (echo) { fputs(buffer,stdout);