You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Roy T. Fielding" <fi...@kiwi.ICS.UCI.EDU> on 1997/03/11 03:34:24 UTC

Re: [PATCH] improved error reporting

It doesn't compile on Solaris 2.5:

fielding@kiwi% make
gcc -c -Iregex  -g -DSOLARIS2 -DSTATUS -Wall  alloc.c
gcc -c -Iregex  -g -DSOLARIS2 -DSTATUS -Wall  http_main.c
http_main.c: In function `default_server_hostnames':
http_main.c:1459: warning: implicit declaration of function `herror'
gcc -c -Iregex  -g -DSOLARIS2 -DSTATUS -Wall  http_config.c
http_config.c: In function `get_addresses':
http_config.c:904: warning: implicit declaration of function `herror'
gcc -c -Iregex  -g -DSOLARIS2 -DSTATUS -Wall  http_log.c
gcc -c -Iregex  -g -DSOLARIS2 -DSTATUS -Wall  util.c
util.c: In function `get_virthost_addr':
util.c:1162: warning: implicit declaration of function `herror'
gcc -c -Iregex  -g -DSOLARIS2 -DSTATUS -Wall  mod_mime.c
gcc -c -Iregex  -g -DSOLARIS2 -DSTATUS -Wall  mod_log_config.c
gcc -c -Iregex  -g -DSOLARIS2 -DSTATUS -Wall  mod_rewrite.c
gcc    -o httpd alloc.o http_main.o http_core.o http_config.o http_request.o http_log.o http_protocol.o rfc1413.o util.o util_script.o modules.o buff.o md5c.o util_md5.o explain.o http_bprintf.o util_date.o util_snprintf.o mod_mime.o mod_access.o mod_auth.o mod_negotiation.o mod_include.o mod_dir.o mod_cgi.o mod_userdir.o mod_alias.o mod_env.o mod_log_config.o mod_asis.o mod_imap.o mod_actions.o mod_browser.o mod_rewrite.o mod_status.o mod_info.o regex/libregex.a  -lsocket -lnsl
Undefined                       first referenced
 symbol                             in file
herror                              http_main.o
ld: fatal: Symbol referencing errors. No output written to httpd
make: *** [httpd] Error 1

Also, it looks like the patch includes the MAXHOSTNAMELEN changes as well.
I'll get your separate MAXHOSTNAMELEN patch and commit that first, so
that you can do a clean diff.

....Roy

Re: [PATCH] improved error reporting

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

> On Mon, 10 Mar 1997, Roy T. Fielding wrote:
> > It doesn't compile on Solaris 2.5:
> 
> Fixed by defining NEED_HERROR for SOLARIS2 and supplying an
> implementation of herror().
> 
> Rob, would you let this get by if I removed the herror() stuff went
> simply with the fixed perror() stuff?

I'm not going to veto it in any form. I only want to remind people
that we're months behind schedule and that other features have been
withdrawn in attempt to finalise 1.2




Re: [PATCH] improved error reporting

Posted by Dean Gaudet <dg...@arctic.org>.
On Mon, 10 Mar 1997, Roy T. Fielding wrote:
> It doesn't compile on Solaris 2.5:

Fixed by defining NEED_HERROR for SOLARIS2 and supplying an
implementation of herror().

Rob, would you let this get by if I removed the herror() stuff went
simply with the fixed perror() stuff?  (Some of our perror()s occur
after a call to, say, fprintf(stderr) ... and so are meaningless.)
I'm not gonna press, I too want to see 1.2 done with.

Dean

Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apache/src/CHANGES,v
retrieving revision 1.196
diff -c -3 -r1.196 CHANGES
*** CHANGES	1997/03/11 06:04:38	1.196
--- CHANGES	1997/03/11 07:47:11
***************
*** 1,5 ****
--- 1,10 ----
  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.  Report h_errno as well in case it's useful.
+      [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/11 07:47:11
***************
*** 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: conf.h
===================================================================
RCS file: /export/home/cvs/apache/src/conf.h,v
retrieving revision 1.87
diff -c -3 -r1.87 conf.h
*** conf.h	1997/03/02 18:15:11	1.87
--- conf.h	1997/03/11 07:47:11
***************
*** 99,104 ****
--- 99,105 ----
  #define HAVE_MMAP
  #define HAVE_CRYPT_H
  int gethostname(char *name, int namelen);
+ #define NEED_HERROR
  
  #elif defined(IRIX)
  #undef HAVE_GMTOFF
Index: http_config.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_config.c,v
retrieving revision 1.44
diff -c -3 -r1.44 http_config.c
*** http_config.c	1997/03/11 06:04:40	1.44
--- http_config.c	1997/03/11 07:47:11
***************
*** 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);
      } 
  
***************
*** 902,907 ****
--- 902,908 ----
      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);
      }
***************
*** 930,937 ****
      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
  
--- 931,940 ----
      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/11 07:47:12
***************
*** 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.128
diff -c -3 -r1.128 http_main.c
*** http_main.c	1997/03/11 06:04:39	1.128
--- http_main.c	1997/03/11 07:47:12
***************
*** 774,781 ****
  #endif
      if (scoreboard_fd == -1)
      {
- 	fprintf (stderr, "Cannot open scoreboard file:\n");
  	perror (scoreboard_fname);
  	exit (1);
      }
  
--- 774,781 ----
  #endif
      if (scoreboard_fd == -1)
      {
  	perror (scoreboard_fname);
+ 	fprintf (stderr, "Cannot open scoreboard file:\n");
  	exit (1);
      }
  
***************
*** 800,807 ****
  #endif
      if (scoreboard_fd == -1)
      {
- 	fprintf (stderr, "Cannot open scoreboard file:\n");
  	perror (scoreboard_fname);
  	exit (1);
      }
  #else
--- 800,807 ----
  #endif
      if (scoreboard_fd == -1)
      {
  	perror (scoreboard_fname);
+ 	fprintf (stderr, "Cannot open scoreboard file:\n");
  	exit (1);
      }
  #else
***************
*** 1195,1216 ****
      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
--- 1195,1216 ----
      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
***************
*** 1219,1226 ****
      pgrp=-getpid();
  #else
      if((pgrp=setpgrp(getpid(),0)) == -1) {
-         fprintf(stderr,"httpd: setpgrp failed\n");
          perror("setpgrp");
          exit(1);
      }
  #endif    
--- 1219,1226 ----
      pgrp=-getpid();
  #else
      if((pgrp=setpgrp(getpid(),0)) == -1) {
          perror("setpgrp");
+         fprintf(stderr,"httpd: setpgrp failed\n");
          exit(1);
      }
  #endif    
***************
*** 1451,1456 ****
--- 1451,1457 ----
      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",
***************
*** 1500,1512 ****
  	    {
  		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);
! 		    }
  	    }
  	}
      }
--- 1501,1513 ----
  	    {
  		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);
! 		}
  	    }
  	}
      }
***************
*** 1561,1568 ****
      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 */
--- 1562,1571 ----
      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 */
***************
*** 1924,1933 ****
  #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));
--- 1927,1936 ----
  #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/11 07:47:12
***************
*** 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/11 07:47:12
***************
*** 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/11 07:47:12
***************
*** 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/11 07:47:12
***************
*** 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/11 07:47:14
***************
*** 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.49
diff -c -3 -r1.49 util.c
*** util.c	1997/03/11 03:24:24	1.49
--- util.c	1997/03/11 07:47:14
***************
*** 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);
      }
***************
*** 1205,1210 ****
--- 1206,1212 ----
      }
      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);
***************
*** 1308,1312 ****
--- 1310,1346 ----
  
      p = sys_errlist[err];
      return (p);
+ }
+ #endif
+ 
+ 
+ #ifdef NEED_HERROR
+ void herror (const char *str) {
+ 
+     char buf[ 256 ];
+     const char *p;
+ 
+     switch (h_errno) {
+     case HOST_NOT_FOUND:
+ 	p = "Host not found";
+ 	break;
+     case TRY_AGAIN:
+ 	p = "Try again";
+ 	break;
+     case NO_RECOVERY:
+ 	p = "No recovery";
+ 	break;
+     case NO_DATA:
+ 	p = "No data";
+ 	break;
+     case NO_ADDRESS:
+ 	p = "No address";
+ 	break;
+     default:
+ 	ap_snprintf (buf, sizeof (buf), "Unknown h_error %d", h_error);
+ 	p = buf;
+ 	break;
+     }
+     fprintf (stderr, "%s: %s\n", str, p);
  }
  #endif