]> granicus.if.org Git - apache/commitdiff
Make ap_child_init_lock() work properly... It didn't
authorJeff Trawick <trawick@apache.org>
Wed, 19 Jul 2000 17:42:56 +0000 (17:42 +0000)
committerJeff Trawick <trawick@apache.org>
Wed, 19 Jul 2000 17:42:56 +0000 (17:42 +0000)
call ap_unix_child_init_lock() at the right time, so any
lock mechanism which had interesting work to do (only flock())
was broken.

Fix the flock() flavor of ap_unix_child_init_lock().  It expected
to create the lock file when it should in fact open the existing
one.  It also neglected to return the new ap_lock_t structure to
the caller.

Improve logging of lock init errors in prefork (I know, prefork is
a lame duck, but I used the improved logging in prefork to help
debug the problem).

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85861 13f79535-47bb-0310-9956-ffa450edef68

server/mpm/prefork/prefork.c

index fa5166e425b13afea53b473a93f73c53099d0ad9..0910c8a3674fa1b55e649d65f6a939e67f3ca053 100644 (file)
@@ -256,7 +256,14 @@ static void expand_lock_fname(ap_pool_t *p)
  */
 static void accept_mutex_child_init(ap_pool_t *p)
 {
-    ap_child_init_lock(&accept_lock, ap_lock_fname, p);
+    ap_status_t rv;
+
+    rv = ap_child_init_lock(&accept_lock, ap_lock_fname, p);
+    if (rv) {
+       ap_log_error(APLOG_MARK, APLOG_EMERG, rv, NULL, 
+                     "couldn't do child init for accept mutex");
+        clean_child_exit(APEXIT_CHILDINIT);
+    }
 }
 
 /* Initialize mutex lock.
@@ -269,7 +276,8 @@ static void accept_mutex_init(ap_pool_t *p)
     expand_lock_fname(p);
     rv = ap_create_lock(&accept_lock, APR_MUTEX, APR_CROSS_PROCESS, ap_lock_fname, p);
     if (rv) {
-       ap_log_error(APLOG_MARK, APLOG_ERR, rv, NULL, "couldn't create accept mutex");
+       ap_log_error(APLOG_MARK, APLOG_EMERG, rv, NULL, "couldn't create accept mutex");
+        exit(APEXIT_INIT);
     }
 }