From: Jeff Trawick Date: Mon, 12 Jun 2000 21:39:57 +0000 (+0000) Subject: Fix logging of errors creating the httpd.pid file. X-Git-Tag: APACHE_2_0_ALPHA_5~345 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bfbb1c736d0164f35521d68c7e639d79d85291da;p=apache Fix logging of errors creating the httpd.pid file. perror() was converted to ap_log_error(), which will interpret the specified APR error code properly. The existing ap_log_error() call was changed so that the message is formatted properly. Note that this call is made from the mpm after we detach from the foreground process, so it can only appear in the log. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85551 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/log.c b/server/log.c index 248f497cc0..ad261a5ef0 100644 --- a/server/log.c +++ b/server/log.c @@ -490,6 +490,7 @@ void ap_log_pid(ap_pool_t *p, const char *fname) ap_finfo_t finfo; static pid_t saved_pid = -1; pid_t mypid; + ap_status_t rv; if (!fname) return; @@ -511,10 +512,11 @@ void ap_log_pid(ap_pool_t *p, const char *fname) ); } - if (ap_open(&pid_file, fname, APR_WRITE | APR_CREATE | APR_TRUNCATE, - APR_UREAD | APR_UWRITE | APR_GREAD | APR_WREAD, p) != APR_SUCCESS) { - perror("fopen"); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + if ((rv = ap_open(&pid_file, fname, APR_WRITE | APR_CREATE | APR_TRUNCATE, + APR_UREAD | APR_UWRITE | APR_GREAD | APR_WREAD, p)) != APR_SUCCESS) { + ap_log_error(APLOG_MARK, APLOG_ERR, rv, NULL, + "could not create %s", fname); + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, NULL, "%s: could not log pid to file %s", ap_server_argv0, fname); exit(1);