Received: (from majordom@localhost) by hyperreal.org (8.8.5/8.8.5) id SAA21294; Wed, 9 Jul 1997 18:22:30 -0700 (PDT) Received: from cs.bu.edu (root@CS.BU.EDU [128.197.13.2]) by hyperreal.org (8.8.5/8.8.5) with ESMTP id SAA21288 for ; Wed, 9 Jul 1997 18:22:26 -0700 (PDT) Received: from csa.bu.edu (stanleyg@CSA.BU.EDU [128.197.12.3]) by cs.bu.edu (8.8.5/8.8.5/(BU-S-01/27/97-fc1)) with ESMTP id VAA25768 for ; Wed, 9 Jul 1997 21:22:16 -0400 (EDT) Received: from localhost (stanleyg@localhost) by csa.bu.edu (8.8.5/8.8.5/(BU-C-01/27/97-fc1)) with SMTP id VAA07939 for ; Wed, 9 Jul 1997 21:22:11 -0400 (EDT) X-Authentication-Warning: csa.bu.edu: stanleyg owned process doing -bs Date: Wed, 9 Jul 1997 21:22:11 -0400 (EDT) From: Stanley Gambarin X-Sender: stanleyg@csa To: new-httpd@apache.org Subject: stdin/stdout/stderr_FILENO's Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org This is NOT a bug.. Currently, some of the modules make an implicit assumption that file descriptors are matched as follows: stdin = 0, stdout = 1, stderr=2. Even though it is true for most (all Unix) systems, Stevens suggests using STD[IN|OUT|ERR}_FILENO defines instead to provide better portability. The following diffs hange those. Note, that the defines are declared in unistd.h (on Solaris, at least), which is included by buff.h, which itself is included by httpd.h, which is included by most modules, so they should always be defined (I think)... Stanley. *** mod_cgi.c Wed Jul 9 21:08:57 1997 --- mod_cgi2.c Wed Jul 9 21:07:50 1997 *************** *** 336,342 **** ap_snprintf(err_string, sizeof(err_string), "exec of %s failed, reason: %s (errno = %d)\n", r->filename, strerror(errno), errno); ! write(STDERR_FILENO, err_string, strlen(err_string)); exit(0); /* NOT REACHED */ return(0); --- 336,342 ---- 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); /* NOT REACHED */ return(0); *** mod_include.c Wed Jul 9 21:10:51 1997 --- mod_include2.c Wed Jul 9 21:07:59 1997 *************** *** 663,669 **** ap_snprintf(err_string, sizeof(err_string), "httpd: exec of %s failed, reason: %s (errno = %d)\n", SHELL_PATH, strerror(errno), errno); ! write (STDERR_FILENO, err_string, strlen(err_string)); exit(0); /* NOT REACHED */ return(child_pid); --- 663,669 ---- 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); /* NOT REACHED */ return(child_pid); *** mod_mime_magic.c Wed Jul 9 21:13:14 1997 --- mod_mime_magic2.c Wed Jul 9 21:08:14 1997 *************** *** 2291,2307 **** } switch (fork()) { case 0: /* child */ ! (void) close(STDIN_FILENO); (void) dup(fdin[0]); (void) close(fdin[0]); (void) close(fdin[1]); ! (void) close(STDOUT_FILENO) (void) dup(fdout[1]); (void) close(fdout[0]); (void) close(fdout[1]); if (compr[method].silent) ! (void) close(STDERR_FILENO); execvp(compr[method].argv[0], compr[method].argv); log_printf(s, "%s: could not execute `%s' (%s).\n", MODNAME, --- 2291,2307 ---- } switch (fork()) { case 0: /* child */ ! (void) close(0); (void) dup(fdin[0]); (void) close(fdin[0]); (void) close(fdin[1]); ! (void) close(1); (void) dup(fdout[1]); (void) close(fdout[0]); (void) close(fdout[1]); if (compr[method].silent) ! (void) close(2); execvp(compr[method].argv[0], compr[method].argv); log_printf(s, "%s: could not execute `%s' (%s).\n", MODNAME,