- unsigned long ret = 0;\r
- GetExitCodeProcess(pid, &ret);\r
+ unsigned long exitcode = 0;\r
+ GetExitCodeProcess(process_handle, &exitcode);\r
+\r
+ /* Clean up. */\r
+ kill_process_tree(service_name, pid, exitcode, pid);\r
+\r
+ /*\r
+ The why argument is true if our wait timed out or false otherwise.\r
+ Our wait is infinite so why will never be true when called by the system.\r
+ If it is indeed true, assume we were called from stop_service() because\r
+ this is a controlled shutdown, and don't take any restart action.\r
+ */\r
+ if (why) return;\r