Skip to content

Commit ddacf84

Browse files
committed
-MPMs prefork & worker: avoid segfault with SAFE_ACCEPT in ONE_PROCESS mode.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1601170 13f79535-47bb-0310-9956-ffa450edef68
1 parent a197887 commit ddacf84

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

server/mpm/prefork/prefork.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,10 @@ static int make_child(server_rec *s, int slot)
755755
retained->max_daemons_limit = slot + 1;
756756
}
757757

758+
child_listen = mpm_listen[bucket[slot]];
759+
child_mutex = accept_mutex[bucket[slot]];
760+
child_pod = pod[bucket[slot]];
761+
758762
if (one_process) {
759763
apr_signal(SIGHUP, sig_term);
760764
/* Don't catch AP_SIG_GRACEFUL in ONE_PROCESS mode :) */
@@ -771,10 +775,6 @@ static int make_child(server_rec *s, int slot)
771775
(void) ap_update_child_status_from_indexes(slot, 0, SERVER_STARTING,
772776
(request_rec *) NULL);
773777

774-
child_listen = mpm_listen[bucket[slot]];
775-
child_mutex = accept_mutex[bucket[slot]];
776-
child_pod = pod[bucket[slot]];
777-
778778
#ifdef _OSD_POSIX
779779
/* BS2000 requires a "special" version of fork() before a setuid() call */
780780
if ((pid = os_fork(ap_unixd_config.user_name)) == -1) {

server/mpm/worker/worker.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -1407,17 +1407,17 @@ static int make_child(server_rec *s, int slot)
14071407
retained->max_daemons_limit = slot + 1;
14081408
}
14091409

1410+
child_listen = mpm_listen[bucket[slot]];
1411+
child_mutex = accept_mutex[bucket[slot]];
1412+
child_pod = pod[bucket[slot]];
1413+
14101414
if (one_process) {
14111415
set_signals();
14121416
worker_note_child_started(slot, getpid());
14131417
child_main(slot);
14141418
/* NOTREACHED */
14151419
}
14161420

1417-
child_listen = mpm_listen[bucket[slot]];
1418-
child_mutex = accept_mutex[bucket[slot]];
1419-
child_pod = pod[bucket[slot]];
1420-
14211421
if ((pid = fork()) == -1) {
14221422
ap_log_error(APLOG_MARK, APLOG_ERR, errno, s, APLOGNO(00283)
14231423
"fork: Unable to fork new process");

0 commit comments

Comments
 (0)