httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk.vanGu...@jrc.it
Subject Making an error with Bind/ServerName a bit more elaborate
Date Mon, 23 Dec 1996 10:39:10 GMT

After spending hours on the phone with a desperate person,
here is a suggestion to make the error when ServerName
barfs a bit more elaborate; at the expense of an tmp
variable.

Dw.


RCS file: /home/cvs/apache/src/http_main.c,v
retrieving revision 1.1.1.1
diff -c -3 -r1.1.1.1 http_main.c
*** http_main.c	1996/12/05 16:58:06	1.1.1.1
--- http_main.c	1996/12/09 19:07:24
***************
*** 1268,1285 ****
      server_addr_rec *sar;
      int has_inaddr_any;
      int mainport = s->port;
  
      /* Main host first */
      
      if (!s->server_hostname) {
  	s->server_hostname = get_local_host(pconf);
      }
  
      def_hostname = s->server_hostname;
      h = gethostbyname(def_hostname);
      if( h == NULL ) {
! 	fprintf(stderr,"httpd: cannot determine local host name.\n");
! 	fprintf(stderr,"Use ServerName to set it manually.\n");
  	exit(1);
      }
      /* we need to use gethostbyaddr below... and since it shares a 
static
--- 1268,1293 ----
      server_addr_rec *sar;
      int has_inaddr_any;
      int mainport = s->port;
+     int from_local=0;  
  
      /* Main host first */
      
      if (!s->server_hostname) {
  	s->server_hostname = get_local_host(pconf);
+ 	from_local = 1;
      }
  
      def_hostname = s->server_hostname;
      h = gethostbyname(def_hostname);
      if( h == NULL ) {
! 	fprintf(stderr,"httpd: cannot determine the IP address of ");
! 	if (from_local) {
! 	   fprintf(stderr,"the local host (%s). Use ServerName to set it 
manually.\n",
! 		s->server_hostname ? s->server_hostname : "<NULL>");
! 	} else {
! 	   fprintf(stderr,"the specified ServerName (%s).\n",
! 		s->server_hostname ? s->server_hostname : "<NULL>");
! 	};
  	exit(1);
      }
      /* we need to use gethostbyaddr below... and since it shares a 
static


Mime
View raw message