comparison lib-src/gnuserv.c @ 5853:1044acf60048

Revert part of Jerry's December 2014 that broke gnuclient on some OS X. lib-src/ChangeLog addition: 2015-03-08 Aidan Kehoe <kehoea@parhasard.net> * gnuserv.c (echo_request): No longer close the file handle unconditionally, leave this to the individual socket types. * gnuserv.c (handle_internet_request): Close the file handle here. * gnuserv.c (handle_unix_request): Don't close the file handle here, document why (it broke gnuclient under OS X). It should actually be OK, but my suspicion is that the issues is that the Unix (local) domain sockets are still underdocumented compared to the internet sockets.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 08 Mar 2015 20:59:25 +0000
parents c03dd89e0055
children
comparison
equal deleted inserted replaced
5852:e9bb3688e654 5853:1044acf60048
319 perror(progname); 319 perror(progname);
320 fprintf(stderr,"%s: unable to recv\n",progname); 320 fprintf(stderr,"%s: unable to recv\n",progname);
321 exit(1); 321 exit(1);
322 } /* if */ 322 } /* if */
323 323
324 close(s);
325 } /* echo_request */ 324 } /* echo_request */
326 325
327 326
328 /* 327 /*
329 handle_response -- accept a response from stdin (the gnu process) and pass the 328 handle_response -- accept a response from stdin (the gnu process) and pass the
752 return; 751 return;
753 } /* if */ 752 } /* if */
754 753
755 echo_request(s); 754 echo_request(s);
756 755
756 close(s);
757 } /* handle_internet_request */ 757 } /* handle_internet_request */
758 #endif /* INTERNET_DOMAIN_SOCKETS */ 758 #endif /* INTERNET_DOMAIN_SOCKETS */
759 759
760 760
761 #ifdef UNIX_DOMAIN_SOCKETS 761 #ifdef UNIX_DOMAIN_SOCKETS
862 return; 862 return;
863 } /* if */ 863 } /* if */
864 864
865 echo_request(s); 865 echo_request(s);
866 866
867 /* Closing s here (or rather, within echo_request() with both
868 internet and local connections) meant gnuserv never returned
869 usefully under OS X, as of 20150308, reflecting changeset
870 https://bitbucket.org/xemacs/xemacs/commits/c03dd89 . Keeping it
871 open is not a significant security risk (it's a local connection,
872 with file system access restrictions) and given the practical
873 limitation on the number of handles gnuserv will keep around,
874 it's also not a significant resource issue. Leave it open. */
867 } /* handle_unix_request */ 875 } /* handle_unix_request */
868 #endif /* UNIX_DOMAIN_SOCKETS */ 876 #endif /* UNIX_DOMAIN_SOCKETS */
869 877
870 878
871 int 879 int