dgaudet 97/07/09 11:07:41
Modified: src http_main.c Log: PR#832: fix broken solaris SIGHUP Revision Changes Path 1.175 +33 -20 apache/src/http_main.c Index: http_main.c =================================================================== RCS file: /export/home/cvs/apache/src/http_main.c,v retrieving revision 1.174 retrieving revision 1.175 diff -C3 -r1.174 -r1.175 *** http_main.c 1997/07/07 14:34:26 1.174 --- http_main.c 1997/07/09 18:07:40 1.175 *************** *** 1801,1806 **** --- 1801,1832 ---- #define sock_disable_nagle(s) /* NOOP */ #endif + + static void sock_bind (int s, const struct sockaddr_in *server) + { + #ifdef MPE + /* MPE requires CAP=PM and GETPRIVMODE to bind to ports less than 1024 */ + if (ntohs(server->sin_port) < 1024) GETPRIVMODE(); + #endif + if(bind(s, (struct sockaddr *)server,sizeof(struct sockaddr_in)) == -1) + { + perror("bind"); + #ifdef MPE + if (ntohs(server->sin_port) < 1024) GETUSERMODE(); + #endif + if (server->sin_addr.s_addr != htonl(INADDR_ANY)) + fprintf(stderr,"httpd: could not bind to address %s port %d\n", + inet_ntoa(server->sin_addr), ntohs(server->sin_port)); + else + fprintf(stderr,"httpd: could not bind to port %d\n", + ntohs(server->sin_port)); + exit(1); + } + #ifdef MPE + if (ntohs(server->sin_port) < 1024) GETUSERMODE(); + #endif + } + static int make_sock(pool *pconf, const struct sockaddr_in *server) { int s; *************** *** 1812,1817 **** --- 1838,1847 ---- exit(1); } + #ifdef SOLARIS2 + sock_bind (s, server); + #endif + s = ap_slack(s, AP_SLACK_HIGH); note_cleanups_for_socket(pconf, s); /* arrange to close on exec or restart */ *************** *** 1861,1887 **** } } ! #ifdef MPE ! /* MPE requires CAP=PM and GETPRIVMODE to bind to ports less than 1024 */ ! if (ntohs(server->sin_port) < 1024) GETPRIVMODE(); ! #endif ! if(bind(s, (struct sockaddr *)server,sizeof(struct sockaddr_in)) == -1) ! { ! perror("bind"); ! #ifdef MPE ! if (ntohs(server->sin_port) < 1024) GETUSERMODE(); ! #endif ! if (server->sin_addr.s_addr != htonl(INADDR_ANY)) ! fprintf(stderr,"httpd: could not bind to address %s port %d\n", ! inet_ntoa(server->sin_addr), ntohs(server->sin_port)); ! else ! fprintf(stderr,"httpd: could not bind to port %d\n", ! ntohs(server->sin_port)); ! exit(1); ! } ! #ifdef MPE ! if (ntohs(server->sin_port) < 1024) GETUSERMODE(); #endif listen(s, listenbacklog); return s; } --- 1891,1900 ---- } } ! #ifndef SOLARIS2 ! sock_bind (s, server); #endif + listen(s, listenbacklog); return s; }