Fix the EINTR check for waitpid, Gentoo #219929.

This commit is contained in:
Roy Marples 2008-05-06 21:53:21 +00:00
parent c8248d05a0
commit 619b0b4f37
2 changed files with 17 additions and 17 deletions

View File

@ -120,18 +120,25 @@ void rc_plugin_load(void)
int rc_waitpid(pid_t pid)
{
int status = 0;
int status;
pid_t savedpid = pid;
int retval = EXIT_FAILURE;
do {
loop:
pid = waitpid(savedpid, &status, 0);
if (pid == -1 && errno != EINTR)
if (pid == -1) {
/* Our signal hander should take appropriate action. */
if (errno == EINTR)
goto loop;
return EXIT_FAILURE;
} while (!WIFEXITED(status) && !WIFSIGNALED(status));
if (pid == savedpid)
retval = WIFEXITED(status) ? WEXITSTATUS(status) : EXIT_FAILURE;
return retval;
}
if (pid == savedpid) {
if (WIFEXITED(status))
return WEXITSTATUS(status);
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
void rc_plugin_run(RC_HOOK hook, const char *value)

View File

@ -635,13 +635,6 @@ static void do_newlevel(const char *newlevel)
{
/* OK, we're either in runlevel 1 or single user mode */
/* We don't want to trap SIGWINCH here as when a framebuffer
* driver is loaded by udev and we start using it then we
* race for some reason with the below scripts.
* This is fine as we only really need SIGWINCH for tidy
* output when using the logger. */
signal_setup(SIGWINCH, SIG_DFL);
/* exec init-early.sh if it exists
* This should just setup the console to use the correct
* font. Maybe it should setup the keyboard too? */