diff options
author | Lennart Poettering <lennart@poettering.net> | 2011-06-30 04:15:39 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2011-06-30 04:15:39 +0200 |
commit | 3dead8d925ea9db1fbd65b702b6b807e49ddeacf (patch) | |
tree | 178fdbe375496bf0740e80dead1a76cfbcd9c3de | |
parent | 0f1df8e1691f6a0397153860caf28fda38231833 (diff) |
execute: invoke sigwait() in a loop when waiting for PAM parent, to avoid spurious wake-ups
-rw-r--r-- | src/execute.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/execute.c b/src/execute.c index 1a5f09d324..c69442d0ff 100644 --- a/src/execute.c +++ b/src/execute.c @@ -843,7 +843,7 @@ static int setup_pam( /* This string must fit in 10 chars (i.e. the length * of "/sbin/init") */ - rename_process("sd:pam"); + rename_process("sd(PAM)"); /* Make sure we don't keep open the passed fds in this child. We assume that otherwise only those fds are @@ -861,13 +861,20 @@ static int setup_pam( /* Check if our parent process might already have * died? */ if (getppid() == parent_pid) { - if (sigwait(&ss, &sig) < 0) - goto child_finish; + for (;;) { + if (sigwait(&ss, &sig) < 0) { + if (errno == EINTR) + continue; + + goto child_finish; + } - assert(sig == SIGTERM); + assert(sig == SIGTERM); + break; + } } - /* Only if our parent died we'll end the session */ + /* If our parent died we'll end the session */ if (getppid() != parent_pid) if ((pam_code = pam_close_session(handle, PAM_DATA_SILENT)) != PAM_SUCCESS) goto child_finish; |