You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Marc Slemko <ma...@znep.com> on 1997/06/10 03:02:55 UTC

[PATCH] give me useless text, not useless errno

errno is great, but it means nothing to most people.  Text is great, but
it can be damn near impossible to figure out which errno it corresponds
to.  That means we need both. 

Actually, a better log_unixerr (variable arguments) wouldn't hurt, but not
right now.

Index: mod_cgi.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_cgi.c,v
retrieving revision 1.39
diff -c -r1.39 mod_cgi.c
*** mod_cgi.c	1997/04/21 20:29:09	1.39
--- mod_cgi.c	1997/06/10 00:57:30
***************
*** 333,339 ****
       */
      
      ap_snprintf(err_string, sizeof(err_string),
! 	    "exec of %s failed, errno is %d\n", r->filename, errno);
      write(2, err_string, strlen(err_string));
      exit(0);
  }
--- 333,340 ----
       */
      
      ap_snprintf(err_string, sizeof(err_string),
! 	    "exec of %s failed, reason: %s (errno = %d)\n", 
!             r->filename, strerror(errno), errno);
      write(2, err_string, strlen(err_string));
      exit(0);
  }
Index: mod_include.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_include.c,v
retrieving revision 1.33
diff -c -r1.33 mod_include.c
*** mod_include.c	1997/06/05 00:57:45	1.33
--- mod_include.c	1997/06/10 00:57:34
***************
*** 646,653 ****
      fprintf (dbg, "Exec failed\n");
  #endif    
      ap_snprintf(err_string, sizeof(err_string),
! 	"httpd: exec of %s failed, errno is %d\n",
! 	SHELL_PATH,errno);
      write (2, err_string, strlen(err_string));
      exit(0);
  }
--- 646,653 ----
      fprintf (dbg, "Exec failed\n");
  #endif    
      ap_snprintf(err_string, sizeof(err_string),
! 	"httpd: exec of %s failed, reason: %s (errno = %d)\n",
! 	SHELL_PATH, strerror(errno), errno);
      write (2, err_string, strlen(err_string));
      exit(0);
  }
Index: util_script.c
===================================================================
RCS file: /export/home/cvs/apache/src/util_script.c,v
retrieving revision 1.58
diff -c -r1.58 util_script.c
*** util_script.c	1997/05/11 23:13:22	1.58
--- util_script.c	1997/06/10 00:57:36
***************
*** 502,508 ****
          program = fopen (r->filename, "r");
          if (!program) {
              char err_string[HUGE_STRING_LEN];
!             ap_snprintf(err_string, sizeof(err_string), "open of %s failed, errno is %d\n", r->filename, errno);
              /* write(2, err_string, strlen(err_string)); */
              /* exit(0); */
              log_unixerr("fopen", NULL, err_string, r->server);
--- 502,511 ----
          program = fopen (r->filename, "r");
          if (!program) {
              char err_string[HUGE_STRING_LEN];
!             ap_snprintf(err_string, sizeof(err_string), 
! 		 "open of %s failed, reason: fopen: %s (errno = %d)\n", 
! 		 r->filename, strerror(errno), errno);
! 
              /* write(2, err_string, strlen(err_string)); */
              /* exit(0); */
              log_unixerr("fopen", NULL, err_string, r->server);


Re: [PATCH] give me useless text, not useless errno

Posted by Chuck Murcko <ch...@topsail.org>.
Marc Slemko wrote:
> 
> errno is great, but it means nothing to most people.  Text is great, but
> it can be damn near impossible to figure out which errno it corresponds
> to.  That means we need both.
> 
> Actually, a better log_unixerr (variable arguments) wouldn't hurt, but not
> right now.
> 
+1. Agreed. Many times the errno is out of date WRT the log entry, but
at least that will be more obvious now.
-- 
chuck
Chuck Murcko
The Topsail Group, West Chester PA USA
chuck@topsail.org