You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "William A. Rowe, Jr." <wr...@lnd.com> on 2000/06/17 09:46:39 UTC

A minor issue of exit()s

Here's a short list of *_exit() calls that look like targets for a 
value of 1... this will make the workaround of close Win32 console
on success work more effectively...  Any objections to this list?

(I also considered -success- cases, like -h, that are just feedback
 results, but have a different way to work around this if the user
 wants a shortcut, just use %comspec% /k ""Apache.exe" args" and we
 -will- hang around afterwards.)



Index: http_main.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/main/http_main.c,v
retrieving revision 1.503
diff -u -r1.503 http_main.c
--- http_main.c	2000/06/16 18:31:04	1.503
+++ http_main.c	2000/06/17 07:43:45
@@ -5677,7 +5677,7 @@
         
         ap_destroy_pool(pchild);
         cleanup_scoreboard();
-        exit(0);
+        exit(1);
     }
     
     set_signals();
@@ -5879,7 +5879,7 @@
 
 	ap_destroy_pool(pchild);
 	cleanup_scoreboard();
-	exit(0);
+	exit(1);
     }
     if (rv == WAIT_OBJECT_0 + 1) {
 	/* exit event signalled - exit now */
@@ -5904,7 +5904,7 @@
 
 	ap_destroy_pool(pchild);
 	cleanup_scoreboard();
-	exit(0);
+	exit(1);
     }
     set_signals();
 
@@ -6785,14 +6785,14 @@
         if (install > 0) {
             ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, NULL,
                          "Service \"%s\" is already installed!", service_name);
-            clean_parent_exit(0);
+            clean_parent_exit(1);
         }
     }
     else if (service_name && (install <= 0))
     {
         ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, NULL,
                      "Service \"%s\" is not installed!", service_name);
-        clean_parent_exit(0);
+        clean_parent_exit(1);
     }
 #endif
 
@@ -6851,16 +6851,20 @@
 
     if (service_name && !conf_specified) {
         printf("Unknown service: %s\n", service_name);
-        clean_parent_exit(0);
+        clean_parent_exit(1);
     }
 
     /* All NT signals, and all but the 9x start signal are handled entirely.
      * Die if we failed, are on NT, or are not "start"ing the service
      */
     if (service_name && signal_to_send) {
-        if (!send_signal_to_service(service_name, signal_to_send)
-                || isWindowsNT() || strcasecmp(signal_to_send, "start"))
+        if (!send_signal_to_service(service_name, signal_to_send))
+            clean_parent_exit(1);
+        if (isWindowsNT() || strcasecmp(signal_to_send, "start"))
             clean_parent_exit(0);
+        /* Still here?  Then we are hanging around to detach the console 
+         * and use this process as the Windows 9x service.
+         */
     }
 #else /* ndef WIN32 */
     server_conf = ap_read_config(pconf, ptrans, ap_server_confname);