]> granicus.if.org Git - apache/commitdiff
Fix logging of errors creating the httpd.pid file.
authorJeff Trawick <trawick@apache.org>
Mon, 12 Jun 2000 21:39:57 +0000 (21:39 +0000)
committerJeff Trawick <trawick@apache.org>
Mon, 12 Jun 2000 21:39:57 +0000 (21:39 +0000)
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

server/log.c

index 248f497cc0f3e3f62c4c6c18f14b9de266500d7b..ad261a5ef0a83a4db386a7c07f5d585aa3edb21d 100644 (file)
@@ -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);