You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Dean Gaudet <dg...@arctic.org> on 1997/03/10 14:30:23 UTC

[PATCH] improved error reporting

I'm tired of seeing bug reports that don't include at least the value of
errno... so I put together this patch.  Essentially every time we barf an
error on stderr (especially those that exit()) this patch calls perror() 
(or herror()). 

It improves spawn_child, popenf, and pclosef to preserve the real errno
that we're interested in (rather than some other errno caused by
intermediate cleanup).  It reorders perror() calls so that they appear
before any other i/o operation (all of which will trounce errno happily). 

Dean

Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apache/src/CHANGES,v
retrieving revision 1.193
diff -c -3 -r1.193 CHANGES
*** CHANGES	1997/03/10 09:27:41	1.193
--- CHANGES	1997/03/10 20:50:07
***************
*** 1,5 ****
--- 1,9 ----
  Changes with Apache 1.2b8
  
+   *) Report extra info from errno with many errors that cause httpd to exit.
+      spawn_child, popenf, and pclosef now have valid errno returns in the
+      event of an error. [Dean Gaudet]
+ 
    *) Memory allocation problem in push_array() -- it would corrupt memory
       when nalloc==0.  [Kai Risku <kr...@tf.hut.fi> and Roy Fielding]
  
Index: alloc.c
===================================================================
RCS file: /export/home/cvs/apache/src/alloc.c,v
retrieving revision 1.23
diff -c -3 -r1.23 alloc.c
*** alloc.c	1997/03/10 09:27:41	1.23
--- alloc.c	1997/03/10 20:50:07
***************
*** 742,763 ****
--- 742,769 ----
  int popenf(pool *a, const char *name, int flg, int mode)
  {
    int fd;
+   int save_errno;
  
    block_alarms();
    fd = open(name, flg, mode);
+   save_errno = errno;
    if (fd >= 0) note_cleanups_for_fd (a, fd);
    unblock_alarms();
+   errno = save_errno;
    return fd;
  }
  
  int pclosef(pool *a, int fd)
  {
    int res;
+   int save_errno;
    
    block_alarms();
    res = close(fd);
+   save_errno = errno;
    kill_cleanup(a, (void *)fd, fd_cleanup);
    unblock_alarms();
+   errno = save_errno;
    return res;
  }
  
***************
*** 878,901 ****
--- 884,913 ----
    int in_fds[2];
    int out_fds[2];
    int err_fds[2];
+   int save_errno;
  
    block_alarms();
    
    if (pipe_in && pipe (in_fds) < 0)
    {
+       save_errno = errno;
        unblock_alarms();
+       errno = save_errno;
        return 0;
    }
    
    if (pipe_out && pipe (out_fds) < 0) {
+     save_errno = errno;
      if (pipe_in) {
        close (in_fds[0]); close (in_fds[1]);
      }
      unblock_alarms();
+     errno = save_errno;
      return 0;
    }
  
    if (pipe_err && pipe (err_fds) < 0) {
+     save_errno = errno;
      if (pipe_in) {
        close (in_fds[0]); close (in_fds[1]);
      }
***************
*** 903,912 ****
--- 915,926 ----
        close (out_fds[0]); close (out_fds[1]);
      }
      unblock_alarms();
+     errno = save_errno;
      return 0;
    }
  
    if ((pid = fork()) < 0) {
+     save_errno = errno;
      if (pipe_in) {
        close (in_fds[0]); close (in_fds[1]);
      }
***************
*** 917,922 ****
--- 931,937 ----
        close (err_fds[0]); close (err_fds[1]);
      }
      unblock_alarms();
+     errno = save_errno;
      return 0;
    }
  
Index: http_config.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_config.c,v
retrieving revision 1.43
diff -c -3 -r1.43 http_config.c
*** http_config.c	1997/03/10 09:19:39	1.43
--- http_config.c	1997/03/10 20:50:07
***************
*** 759,767 ****
      parms.override = (RSRC_CONF|OR_ALL)&~(OR_AUTHCFG|OR_LIMIT);
      
      if(!(cfg = fopen(fname, "r"))) {
          fprintf(stderr,"httpd: could not open document config file %s\n",
                  fname);
-         perror("fopen");
          exit(1);
      } 
  
--- 759,767 ----
      parms.override = (RSRC_CONF|OR_ALL)&~(OR_AUTHCFG|OR_LIMIT);
      
      if(!(cfg = fopen(fname, "r"))) {
+         perror("fopen");
          fprintf(stderr,"httpd: could not open document config file %s\n",
                  fname);
          exit(1);
      } 
  
***************
*** 901,906 ****
--- 901,907 ----
      hep = gethostbyname(w);
  
      if ((!hep) || (hep->h_addrtype != AF_INET || !hep->h_addr_list[0])) {
+ 	herror( "get_addresses" );
  	fprintf (stderr, "Cannot resolve host name %s --- exiting!\n", w);
  	exit(1);
      }
***************
*** 929,936 ****
      getrlimit ( RLIMIT_NOFILE, &limits );
      if ( limits.rlim_cur < limits.rlim_max ) {
        limits.rlim_cur += 2;
!       if ( setrlimit ( RLIMIT_NOFILE, &limits ) < 0 )
  	fprintf (stderr, "Cannot exceed hard limit for open files");
      }
  #endif
  
--- 930,939 ----
      getrlimit ( RLIMIT_NOFILE, &limits );
      if ( limits.rlim_cur < limits.rlim_max ) {
        limits.rlim_cur += 2;
!       if ( setrlimit ( RLIMIT_NOFILE, &limits ) < 0 ) {
! 	perror ("setrlimit(RLIMIT_NOFILE)");
  	fprintf (stderr, "Cannot exceed hard limit for open files");
+       }
      }
  #endif
  
Index: http_log.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_log.c,v
retrieving revision 1.12
diff -c -3 -r1.12 http_log.c
*** http_log.c	1997/01/10 09:34:41	1.12
--- http_log.c	1997/03/10 20:50:07
***************
*** 92,110 ****
      if (*s->error_fname == '|') {
        FILE *dummy;
  
!       spawn_child(p, error_log_child, (void *)(s->error_fname+1),
!                     kill_after_timeout, &dummy, NULL);
! 
!         if (dummy == NULL) {
!             fprintf (stderr, "Couldn't fork child for ErrorLog process\n");
!             exit (1);
        }
  
        s->error_log = dummy;
      } else {
          if(!(s->error_log = pfopen(p, fname, "a"))) {
-             fprintf(stderr,"httpd: could not open error log file %s.\n", fname);
              perror("fopen");
              exit(1);
        }
      }
--- 92,109 ----
      if (*s->error_fname == '|') {
        FILE *dummy;
  
!       if (!spawn_child (p, error_log_child, (void *)(s->error_fname+1),
!                     kill_after_timeout, &dummy, NULL)) {
! 	perror ("spawn_child");
! 	fprintf (stderr, "Couldn't fork child for ErrorLog process\n");
! 	exit (1);
        }
  
        s->error_log = dummy;
      } else {
          if(!(s->error_log = pfopen(p, fname, "a"))) {
              perror("fopen");
+             fprintf(stderr,"httpd: could not open error log file %s.\n", fname);
              exit(1);
        }
      }
Index: http_main.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_main.c,v
retrieving revision 1.127
diff -c -3 -r1.127 http_main.c
*** http_main.c	1997/03/04 21:44:38	1.127
--- http_main.c	1997/03/10 20:50:07
***************
*** 779,786 ****
  #endif
      if (scoreboard_fd == -1)
      {
- 	fprintf (stderr, "Cannot open scoreboard file:\n");
  	perror (scoreboard_fname);
  	exit (1);
      }
  
--- 779,786 ----
  #endif
      if (scoreboard_fd == -1)
      {
  	perror (scoreboard_fname);
+ 	fprintf (stderr, "Cannot open scoreboard file:\n");
  	exit (1);
      }
  
***************
*** 805,812 ****
  #endif
      if (scoreboard_fd == -1)
      {
- 	fprintf (stderr, "Cannot open scoreboard file:\n");
  	perror (scoreboard_fname);
  	exit (1);
      }
  #else
--- 805,812 ----
  #endif
      if (scoreboard_fd == -1)
      {
  	perror (scoreboard_fname);
+ 	fprintf (stderr, "Cannot open scoreboard file:\n");
  	exit (1);
      }
  #else
***************
*** 1200,1221 ****
      if((x = fork()) > 0)
          exit(0);
      else if(x == -1) {
-         fprintf(stderr,"httpd: unable to fork new process\n");
          perror("fork");
          exit(1);
      }
  #endif
  #ifndef NO_SETSID
      if((pgrp=setsid()) == -1) {
-         fprintf(stderr,"httpd: setsid failed\n");
          perror("setsid");
          exit(1);
      }
  #else
  #if defined(NEXT)
      if(setpgrp(0,getpid()) == -1 || (pgrp = getpgrp(0)) == -1) {
-         fprintf(stderr,"httpd: setpgrp or getpgrp failed\n");
          perror("setpgrp");
          exit(1);
      }
  #else
--- 1200,1221 ----
      if((x = fork()) > 0)
          exit(0);
      else if(x == -1) {
          perror("fork");
+         fprintf(stderr,"httpd: unable to fork new process\n");
          exit(1);
      }
  #endif
  #ifndef NO_SETSID
      if((pgrp=setsid()) == -1) {
          perror("setsid");
+         fprintf(stderr,"httpd: setsid failed\n");
          exit(1);
      }
  #else
  #if defined(NEXT)
      if(setpgrp(0,getpid()) == -1 || (pgrp = getpgrp(0)) == -1) {
          perror("setpgrp");
+         fprintf(stderr,"httpd: setpgrp or getpgrp failed\n");
          exit(1);
      }
  #else
***************
*** 1224,1231 ****
      pgrp=-getpid();
  #else
      if((pgrp=setpgrp(getpid(),0)) == -1) {
-         fprintf(stderr,"httpd: setpgrp failed\n");
          perror("setpgrp");
          exit(1);
      }
  #endif    
--- 1224,1231 ----
      pgrp=-getpid();
  #else
      if((pgrp=setpgrp(getpid(),0)) == -1) {
          perror("setpgrp");
+         fprintf(stderr,"httpd: setpgrp failed\n");
          exit(1);
      }
  #endif    
***************
*** 1456,1461 ****
--- 1456,1462 ----
      def_hostname = s->server_hostname;
      h = gethostbyname(def_hostname);
      if( h == NULL ) {
+ 	herror("default_server_hostnames");
  	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",
***************
*** 1505,1517 ****
  	    {
  		h = gethostbyaddr ((char *)&(s->addrs->host_addr),
  				   sizeof (struct in_addr), AF_INET);
! 		if (h != NULL)
  		    s->server_hostname = pstrdup (pconf, (char *)h->h_name);
! 		else
! 		    {
  		    fprintf(stderr,"Failed to resolve server name for %s (check DNS)\n",inet_ntoa(s->addrs->host_addr));
  		    exit(0);
! 		    }
  	    }
  	}
      }
--- 1506,1518 ----
  	    {
  		h = gethostbyaddr ((char *)&(s->addrs->host_addr),
  				   sizeof (struct in_addr), AF_INET);
! 		if (h != NULL) {
  		    s->server_hostname = pstrdup (pconf, (char *)h->h_name);
! 		} else {
! 		    herror( "default_server_hostnames" );
  		    fprintf(stderr,"Failed to resolve server name for %s (check DNS)\n",inet_ntoa(s->addrs->host_addr));
  		    exit(0);
! 		}
  	    }
  	}
      }
***************
*** 1566,1573 ****
      const int just_say_no = 1;
  
      if (0 != setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char*)&just_say_no,
! 			sizeof just_say_no))
! 	fprintf(stderr, "httpd: could not set socket option TCP_NODELAY\n");
  }
  #else
  #define sock_disable_nagle(s) /* NOOP */
--- 1567,1576 ----
      const int just_say_no = 1;
  
      if (0 != setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char*)&just_say_no,
! 			sizeof just_say_no)) {
! 	perror ("setsockopt(TCP_NODELAY)");
! 	fprintf (stderr, "httpd: could not set socket option TCP_NODELAY\n");
!     }
  }
  #else
  #define sock_disable_nagle(s) /* NOOP */
***************
*** 1929,1938 ****
  #endif
      if(bind(s, (struct sockaddr *)server,sizeof(struct sockaddr_in)) == -1)
      {
  #ifdef MPE
          if (ntohs(server->sin_port) < 1024) GETUSERMODE();
  #endif
-         perror("bind");
  	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));
--- 1932,1941 ----
  #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));
Index: mod_log_agent.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_log_agent.c,v
retrieving revision 1.10
diff -c -3 -r1.10 mod_log_agent.c
*** mod_log_agent.c	1997/03/07 14:15:42	1.10
--- mod_log_agent.c	1997/03/10 20:50:07
***************
*** 111,116 ****
--- 111,118 ----
  #else    
      execl (SHELL_PATH, SHELL_PATH, "-c", (char *)cmd, NULL);
  #endif    
+     perror ("exec");
+     fprintf (stderr, "Exec of shell for logging failed!!!\n");
      exit (1);
  }
  
***************
*** 126,135 ****
      if (*cls->fname == '|') {
  	FILE *dummy;
  	
! 	spawn_child(p, agent_log_child, (void *)(cls->fname+1),
! 		    kill_after_timeout, &dummy, NULL);
! 
! 	if (dummy == NULL) {
  	    fprintf (stderr, "Couldn't fork child for AgentLog process\n");
  	    exit (1);
  	}
--- 128,136 ----
      if (*cls->fname == '|') {
  	FILE *dummy;
  	
! 	if (!spawn_child (p, agent_log_child, (void *)(cls->fname+1),
! 		    kill_after_timeout, &dummy, NULL)) {
! 	    perror ("spawn_child");
  	    fprintf (stderr, "Couldn't fork child for AgentLog process\n");
  	    exit (1);
  	}
***************
*** 138,145 ****
      }
      else if(*cls->fname != '\0') {
        if((cls->agent_fd = popenf(p, fname, xfer_flags, xfer_mode)) < 0) {
-         fprintf(stderr,"httpd: could not open agent log file %s.\n", fname);
          perror("open");
          exit(1);
        }
      }
--- 139,146 ----
      }
      else if(*cls->fname != '\0') {
        if((cls->agent_fd = popenf(p, fname, xfer_flags, xfer_mode)) < 0) {
          perror("open");
+         fprintf(stderr,"httpd: could not open agent log file %s.\n", fname);
          exit(1);
        }
      }
Index: mod_log_config.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_log_config.c,v
retrieving revision 1.25
diff -c -3 -r1.25 mod_log_config.c
*** mod_log_config.c	1997/03/07 14:15:42	1.25
--- mod_log_config.c	1997/03/10 20:50:08
***************
*** 687,692 ****
--- 687,693 ----
  #else
      execl (SHELL_PATH, SHELL_PATH, "-c", (char *)cmd, NULL);
  #endif
+     perror ("exec");
      fprintf (stderr, "Exec of shell for logging failed!!!\n");
      exit (1);
  }
***************
*** 699,708 ****
      if (*cls->fname == '|') {
          FILE *dummy;
          
!         spawn_child(p, config_log_child, (void *)(cls->fname+1),
!                     kill_after_timeout, &dummy, NULL);
! 
!         if (dummy == NULL) {
              fprintf (stderr, "Couldn't fork child for TransferLog process\n");
              exit (1);
          }
--- 700,708 ----
      if (*cls->fname == '|') {
          FILE *dummy;
          
!         if (!spawn_child (p, config_log_child, (void *)(cls->fname+1),
!                     kill_after_timeout, &dummy, NULL)) {
! 	    perror ("spawn_child");
              fprintf (stderr, "Couldn't fork child for TransferLog process\n");
              exit (1);
          }
***************
*** 712,720 ****
      else {
          char *fname = server_root_relative (p, cls->fname);
          if((cls->log_fd = popenf(p, fname, xfer_flags, xfer_mode)) < 0) {
              fprintf (stderr,
                       "httpd: could not open transfer log file %s.\n", fname);
-             perror("open");
              exit(1);
          }
      }
--- 712,720 ----
      else {
          char *fname = server_root_relative (p, cls->fname);
          if((cls->log_fd = popenf(p, fname, xfer_flags, xfer_mode)) < 0) {
+             perror("open");
              fprintf (stderr,
                       "httpd: could not open transfer log file %s.\n", fname);
              exit(1);
          }
      }
Index: mod_log_referer.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_log_referer.c,v
retrieving revision 1.10
diff -c -3 -r1.10 mod_log_referer.c
*** mod_log_referer.c	1997/03/07 14:15:42	1.10
--- mod_log_referer.c	1997/03/10 20:50:08
***************
*** 125,130 ****
--- 125,131 ----
  #else
      execl (SHELL_PATH, SHELL_PATH, "-c", (char *)cmd, NULL);
  #endif
+     perror ("execl");
      fprintf (stderr, "Exec of shell for logging failed!!!\n");
      exit (1);
  }
***************
*** 141,150 ****
      if (*cls->fname == '|') {
  	FILE *dummy;
  	
! 	spawn_child(p, referer_log_child, (void *)(cls->fname+1),
! 		    kill_after_timeout, &dummy, NULL);
! 
! 	if (dummy == NULL) {
  	    fprintf (stderr, "Couldn't fork child for RefererLog process\n");
  	    exit (1);
  	}
--- 142,150 ----
      if (*cls->fname == '|') {
  	FILE *dummy;
  	
! 	if (!spawn_child (p, referer_log_child, (void *)(cls->fname+1),
! 		    kill_after_timeout, &dummy, NULL)) {
! 	    perror ("spawn_child");
  	    fprintf (stderr, "Couldn't fork child for RefererLog process\n");
  	    exit (1);
  	}
***************
*** 153,160 ****
      }
      else if(*cls->fname != '\0') {
        if((cls->referer_fd = popenf(p, fname, xfer_flags, xfer_mode)) < 0) {
-         fprintf(stderr,"httpd: could not open referer log file %s.\n", fname);
          perror("open");
          exit(1);
        }
      }
--- 153,160 ----
      }
      else if(*cls->fname != '\0') {
        if((cls->referer_fd = popenf(p, fname, xfer_flags, xfer_mode)) < 0) {
          perror("open");
+         fprintf(stderr,"httpd: could not open referer log file %s.\n", fname);
          exit(1);
        }
      }
Index: mod_mime.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_mime.c,v
retrieving revision 1.16
diff -c -3 -r1.16 mod_mime.c
*** mod_mime.c	1997/03/07 14:15:42	1.16
--- mod_mime.c	1997/03/10 20:50:08
***************
*** 193,201 ****
      types_confname = server_root_relative (p, types_confname);
  
      if(!(f = fopen(types_confname,"r"))) {
          fprintf(stderr,"httpd: could not open mime types file %s\n",
                  types_confname);
-         perror("fopen");
          exit(1);
      }
  
--- 193,201 ----
      types_confname = server_root_relative (p, types_confname);
  
      if(!(f = fopen(types_confname,"r"))) {
+         perror("fopen");
          fprintf(stderr,"httpd: could not open mime types file %s\n",
                  types_confname);
          exit(1);
      }
  
Index: mod_rewrite.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_rewrite.c,v
retrieving revision 1.21
diff -c -3 -r1.21 mod_rewrite.c
*** mod_rewrite.c	1997/03/07 12:00:31	1.21
--- mod_rewrite.c	1997/03/10 20:50:09
***************
*** 2241,2249 ****
      fname = server_root_relative(p, conf->rewritelogfile);
      
      if (*conf->rewritelogfile == '|') {
!         spawn_child(p, rewritelog_child, (void *)(conf->rewritelogfile+1),
!                     kill_after_timeout, &fp, NULL);
!         if (fp == NULL) {
              fprintf (stderr, "mod_rewrite: could not fork child for RewriteLog process\n");
              exit (1);
          }
--- 2241,2249 ----
      fname = server_root_relative(p, conf->rewritelogfile);
      
      if (*conf->rewritelogfile == '|') {
!         if (!spawn_child (p, rewritelog_child, (void *)(conf->rewritelogfile+1),
!                     kill_after_timeout, &fp, NULL)) {
! 	    perror ("spawn_child");
              fprintf (stderr, "mod_rewrite: could not fork child for RewriteLog process\n");
              exit (1);
          }
***************
*** 2251,2258 ****
      }
      else if (*conf->rewritelogfile != '\0') {
          if ((conf->rewritelogfp = popenf(p, fname, rewritelog_flags, rewritelog_mode)) < 0) {
-             fprintf(stderr, "mod_rewrite: could not open RewriteLog file %s.\n", fname);
              perror("open");
              exit(1);
          }
      }
--- 2251,2258 ----
      }
      else if (*conf->rewritelogfile != '\0') {
          if ((conf->rewritelogfp = popenf(p, fname, rewritelog_flags, rewritelog_mode)) < 0) {
              perror("open");
+             fprintf(stderr, "mod_rewrite: could not open RewriteLog file %s.\n", fname);
              exit(1);
          }
      }
***************
*** 2396,2401 ****
--- 2396,2402 ----
          fpout = NULL;
          rc = spawn_child(p, rewritemap_program_child, (void *)map->datafile, kill_after_timeout, &fpin, &fpout);
          if (rc == 0 || fpin == NULL || fpout == NULL) {
+ 	    perror ("spawn_child");
              fprintf (stderr, "mod_rewrite: could not fork child for RewriteMap process\n");
              exit (1);
          }
***************
*** 3198,3203 ****
--- 3199,3205 ----
  #endif
  
      if (rc < 0) {
+ 	perror ("flock");
          fprintf(stderr, "Error getting lock. Exiting!");
          exit(1);
      }
***************
*** 3222,3227 ****
--- 3224,3230 ----
  #endif 
  
      if (rc < 0) {
+ 	perror ("flock");
          fprintf(stderr, "Error freeing lock. Exiting!");
          exit(1);
      }
Index: util.c
===================================================================
RCS file: /export/home/cvs/apache/src/util.c,v
retrieving revision 1.48
diff -c -3 -r1.48 util.c
*** util.c	1997/03/07 14:35:46	1.48
--- util.c	1997/03/10 20:50:09
***************
*** 1113,1120 ****
  
      len = sizeof(struct sockaddr);
      if(getsockname(sd,&addr,&len) < 0) {
-         fprintf (stderr, "Can't get local host address!\n");
  	perror ("getsockname");
  	exit(1);
      }
           
--- 1113,1120 ----
  
      len = sizeof(struct sockaddr);
      if(getsockname(sd,&addr,&len) < 0) {
  	perror ("getsockname");
+         fprintf (stderr, "Can't get local host address!\n");
  	exit(1);
      }
           
***************
*** 1159,1164 ****
--- 1159,1165 ----
      hep = gethostbyname(w);
  	    
      if ((!hep) || (hep->h_addrtype != AF_INET || !hep->h_addr_list[0])) {
+ 	herror( "get_virthost_addr" );
  	fprintf (stderr, "Cannot resolve host name %s --- exiting!\n", w);
  	exit(1);
      }
***************
*** 1192,1204 ****
  
  char *get_local_host(pool *a)
  {
!     char str[128];
!     int len = 128;
      char *server_hostname;
- 
      struct hostent *p;
!     gethostname(str, len);
      if((!(p=gethostbyname(str))) || (!(server_hostname = find_fqdn(a, p)))) {
          fprintf(stderr,"httpd: cannot determine local host name.\n");
  	fprintf(stderr,"Use ServerName to set it manually.\n");
  	exit(1);
--- 1193,1212 ----
  
  char *get_local_host(pool *a)
  {
! #ifndef MAXHOSTNAMELEN
! #define MAXHOSTNAMELEN 256
! #endif
!     char str[MAXHOSTNAMELEN+1];
      char *server_hostname;
      struct hostent *p;
! 
!     if( gethostname( str, sizeof( str ) - 1 ) != 0 ) {
! 	perror( "Unable to gethostname" );
! 	exit(1);
!     }
!     str[MAXHOSTNAMELEN] = '\0';
      if((!(p=gethostbyname(str))) || (!(server_hostname = find_fqdn(a, p)))) {
+ 	herror("get_local_host");
          fprintf(stderr,"httpd: cannot determine local host name.\n");
  	fprintf(stderr,"Use ServerName to set it manually.\n");
  	exit(1);




Re: [PATCH] improved error reporting

Posted by Chuck Murcko <ch...@topsail.org>.
Rob Hartill wrote:
> 
> On Mon, 10 Mar 1997, Dean Gaudet wrote:
> 
> > I'm tired of seeing bug reports that don't include at least the value of
> > errno...
> 
> don't look then :-)
> 
> This patch is just way to big for my taste. I'd much rather we release
> 1.2 - quirks and all and open the feature floodgates for 2.0.
> 
> We'll never release 1.2 at this rate. It'll get stable and then half
> a dozen OSes will upgrade and start breaking everything once again.
> 
> Ship it now.
> 
We've got to at least get stable on Solaris. That platform still seems
to have real problems.
-- 
chuck
Chuck Murcko
The Topsail Group, West Chester PA USA
chuck@topsail.org

Re: [PATCH] improved error reporting

Posted by Rob Hartill <ro...@imdb.com>.
On Mon, 10 Mar 1997, Dean Gaudet wrote:

> I'm tired of seeing bug reports that don't include at least the value of
> errno... 

don't look then :-)

This patch is just way to big for my taste. I'd much rather we release
1.2 - quirks and all and open the feature floodgates for 2.0.

We'll never release 1.2 at this rate. It'll get stable and then half
a dozen OSes will upgrade and start breaking everything once again.

Ship it now.


--
Rob Hartill   Internet Movie Database (Ltd)
http://us.imdb.com/Oscars/oscars_1996 -  hype free Oscars (R) info.
http://us.imdb.com/usr/sweepstake     -  Win a 56k X2 modem. Free draw.