changeset 5836:c03dd89e0055

Fix gnuserv file descriptor leak. See <CAHCOHQkOV_1sCqb983jD_odRr19eHeU0OLUr-Rxuj+8bVeZ5Sg@mail.gmail.com> in xemacs-patches.
author Jerry James <james@xemacs.org>
date Mon, 08 Dec 2014 16:27:09 -0700
parents e24390bd4235
children 09b5be18ba0e
files lib-src/ChangeLog lib-src/gnuserv.c
diffstat 2 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lib-src/ChangeLog	Fri Dec 05 16:56:13 2014 -0700
+++ b/lib-src/ChangeLog	Mon Dec 08 16:27:09 2014 -0700
@@ -1,3 +1,8 @@
+2014-12-05  Jerry James  <james@xemacs.org>
+
+	* gnuserv.c (echo_request): close the socket when done
+	(handle_unix_request): do not call echo_request on accept failure
+
 2014-12-05  Jerry James  <james@xemacs.org>
 
 	* pop.c (socket_connection): Do not leak a socket if the POP
--- a/lib-src/gnuserv.c	Fri Dec 05 16:56:13 2014 -0700
+++ b/lib-src/gnuserv.c	Mon Dec 08 16:27:09 2014 -0700
@@ -321,6 +321,7 @@
     exit(1);
   } /* if */
 
+  close(s);
 } /* echo_request */
 
 
@@ -858,6 +859,7 @@
     {
       perror(progname);
       fprintf(stderr,"%s: unable to accept\n",progname);
+      return;
     } /* if */
 
   echo_request(s);