Ignore interupts when waiting for processes to finish. Also, style fixes.

This commit is contained in:
Roy Marples
2008-11-28 10:48:01 +00:00
parent b859710cc8
commit 8b76e1d2e0

View File

@@ -129,28 +129,28 @@ clean_failed(void)
static void static void
cleanup(void) cleanup(void)
{ {
if (applet && strcmp(applet, "rc") == 0) {
#ifdef DEBUG_MEMORY #ifdef DEBUG_MEMORY
RC_PID *p1 = LIST_FIRST(&service_pids); RC_PID *p1 = LIST_FIRST(&service_pids);
RC_PID *p2; RC_PID *p2;
#endif #endif
if (!rc_in_logger && !rc_in_plugin &&
applet && strcmp(applet, "rc") == 0)
{
if (hook_out) if (hook_out)
rc_plugin_run(hook_out, runlevel); rc_plugin_run(hook_out, runlevel);
rc_plugin_unload(); rc_plugin_unload();
if (! rc_in_plugin && termios_orig) { if (termios_orig) {
tcsetattr(STDIN_FILENO, TCSANOW, termios_orig); tcsetattr(STDIN_FILENO, TCSANOW, termios_orig);
free(termios_orig); free(termios_orig);
} }
/* Clean runlevel start, stop markers */ /* Clean runlevel start, stop markers */
if (! rc_in_plugin && ! rc_in_logger) {
rmdir(RC_STARTING); rmdir(RC_STARTING);
rmdir(RC_STOPPING); rmdir(RC_STOPPING);
clean_failed(); clean_failed();
rc_logger_close(); rc_logger_close();
} }
@@ -170,7 +170,6 @@ cleanup(void)
free(runlevel); free(runlevel);
#endif #endif
} }
}
#ifdef __linux__ #ifdef __linux__
static char * static char *
@@ -420,7 +419,12 @@ remove_pid(pid_t pid)
static void static void
wait_for_services(void) wait_for_services(void)
{ {
while (waitpid(0, 0, 0) != -1); for (;;) {
while (waitpid(0, 0, 0) != -1)
;
if (errno != EINTR)
break;
}
} }
static void static void
@@ -602,7 +606,7 @@ do_stop_services(const char *newlevel, bool parallel)
continue; continue;
} }
/* We got this far! Or last check is to see if any any service /* We got this far. Last check is to see if any any service
* that going to be started depends on us */ * that going to be started depends on us */
if (!svc1) { if (!svc1) {
tmplist = rc_stringlist_new(); tmplist = rc_stringlist_new();