diff lib-src/gnuslib.c @ 3556:2161ac78b41e

[xemacs-hg @ 2006-08-11 17:37:17 by james] Prevent potential buffer overflows. Also enable use of shutdown() on linux. <m37j1jez4n.fsf@jerrypc.cs.usu.edu>
author james
date Fri, 11 Aug 2006 17:37:18 +0000
parents b39c14581166
children e6508b64ee08 061f4f90f874
line wrap: on
line diff
--- a/lib-src/gnuslib.c	Fri Aug 11 01:30:23 2006 +0000
+++ b/lib-src/gnuslib.c	Fri Aug 11 17:37:18 2006 +0000
@@ -409,13 +409,11 @@
 
   send_string(s,EOT_STR);		/* make sure server gets string */
 
-#if !defined (linux)  && !defined (_SCO_DS) 
+#ifndef _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) {
@@ -434,7 +432,7 @@
 #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);