aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-05-06 21:53:21 +0000
committerRoy Marples <roy@marples.name>2008-05-06 21:53:21 +0000
commit619b0b4f37dbf05f8e30e15b839ed17ab1a21f5b (patch)
tree2b70fa77035eecab0573fa12a22c2356f68b2994 /src
parentc8248d05a03209511f62c346d6c57ece38a87c6e (diff)
Fix the EINTR check for waitpid, Gentoo #219929.
Diffstat (limited to 'src')
-rw-r--r--src/rc/rc-plugin.c29
-rw-r--r--src/rc/rc.c7
2 files changed, 18 insertions, 18 deletions
diff --git a/src/rc/rc-plugin.c b/src/rc/rc-plugin.c
index 8599af6f..55112f4a 100644
--- a/src/rc/rc-plugin.c
+++ b/src/rc/rc-plugin.c
@@ -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 {
- pid = waitpid(savedpid, &status, 0);
- if (pid == -1 && errno != EINTR)
- return EXIT_FAILURE;
- } while (!WIFEXITED(status) && !WIFSIGNALED(status));
- if (pid == savedpid)
- retval = WIFEXITED(status) ? WEXITSTATUS(status) : EXIT_FAILURE;
- return retval;
+
+loop:
+ pid = waitpid(savedpid, &status, 0);
+ if (pid == -1) {
+ /* Our signal hander should take appropriate action. */
+ if (errno == EINTR)
+ goto loop;
+ return EXIT_FAILURE;
+ }
+
+ 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)
diff --git a/src/rc/rc.c b/src/rc/rc.c
index c1bc97e8..d5e9f34c 100644
--- a/src/rc/rc.c
+++ b/src/rc/rc.c
@@ -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? */