From: Manoj Kasichainula Date: Wed, 4 Aug 1999 00:21:35 +0000 (+0000) Subject: Undo the stupid pipe of death changes I made earlier today. dean noted X-Git-Tag: mpm-merge-1~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=65e96b41262284f1f7d6ead52924fd6198629805;p=apache Undo the stupid pipe of death changes I made earlier today. dean noted that we need an char_of_death array to do this safely, and it's just not worth the effort. The EINTR stuff is left behind, though. Hopefully this is now decent again. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@83566 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/mpm/dexter/dexter.c b/server/mpm/dexter/dexter.c index a3b0f57ac0..dc01001b76 100644 --- a/server/mpm/dexter/dexter.c +++ b/server/mpm/dexter/dexter.c @@ -1404,7 +1404,7 @@ int ap_mpm_run(pool *_pconf, pool *plog, server_rec *s) } if (is_graceful) { - int i, bytes_to_write; + int i; char char_of_death = '!'; ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, server_conf, @@ -1420,17 +1420,12 @@ int ap_mpm_run(pool *_pconf, pool *plog, server_rec *s) } } /* give the children the signal to die */ - /* XXX - This while loop logic should be made into a utility function */ - bytes_to_write = num_daemons; - while (bytes_to_write > 0) { - i = write(pipe_of_death[1], &char_of_death, bytes_to_write); - if (i == -1) { + for (i = 0; i < num_daemons;) { + if (write(pipe_of_death[1], &char_of_death, 1) == -1) { if (errno == EINTR) continue; - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "write pipe_of_death"); - break; + ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "write pipe_of_death"); } - bytes_to_write -= i; + i++; } } else { diff --git a/server/mpm/mpmt_pthread/mpmt_pthread.c b/server/mpm/mpmt_pthread/mpmt_pthread.c index ddb10e71b2..cb390a6182 100644 --- a/server/mpm/mpmt_pthread/mpmt_pthread.c +++ b/server/mpm/mpmt_pthread/mpmt_pthread.c @@ -1463,26 +1463,19 @@ int ap_mpm_run(pool *_pconf, pool *plog, server_rec *s) update_scoreboard_global(); if (is_graceful) { - int i, j, bytes_to_write; + int i, j; char char_of_death = '!'; ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, server_conf, "SIGWINCH received. Doing graceful restart"); - /* give the children the signal to die. Sending more bytes than - * children is okay, because the pipe is recreated for every - * generation */ - /* XXX - This while loop logic should be made into a utility function */ - bytes_to_write = ap_daemons_limit; - while (bytes_to_write > 0) { - i = write(pipe_of_death[1], &char_of_death, bytes_to_write); - if (i == -1) { + /* give the children the signal to die */ + for (i = 0; i < ap_daemons_limit;) { + if (write(pipe_of_death[1], &char_of_death, 1) == -1) { if (errno == EINTR) continue; - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, - "write pipe_of_death"); - break; + ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "write pipe_of_death"); } - bytes_to_write -= i; + i++; } /* This is mostly for debugging... so that we know what is still