]> granicus.if.org Git - apache/commitdiff
Undo the stupid pipe of death changes I made earlier today. dean noted
authorManoj Kasichainula <manoj@apache.org>
Wed, 4 Aug 1999 00:21:35 +0000 (00:21 +0000)
committerManoj Kasichainula <manoj@apache.org>
Wed, 4 Aug 1999 00:21:35 +0000 (00:21 +0000)
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

server/mpm/dexter/dexter.c
server/mpm/mpmt_pthread/mpmt_pthread.c

index a3b0f57ac019e03deb3ece9acabb46320e3ff1cc..dc01001b76790e21b7ca11be86b8ea817ef9a3d4 100644 (file)
@@ -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 {
index ddb10e71b2d20999ddd551abee7e8d72f55a0d69..cb390a6182daeb71b8259b0ac4665e6aad40007f 100644 (file)
@@ -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