diff options
author | Ludwig Nussel | 2012-06-05 15:31:24 +0200 |
---|---|---|
committer | Karel Zak | 2012-06-05 15:51:26 +0200 |
commit | 8ce7dfa341fa969ba08438f97b0d875dbb78d75d (patch) | |
tree | bcaba8e2a3a87e0c62601765d5792e7bea1ff557 /login-utils/su.c | |
parent | inclide/env: innclude c.h, remove _() macro from xsetenv() (diff) | |
download | kernel-qcow2-util-linux-8ce7dfa341fa969ba08438f97b0d875dbb78d75d.tar.gz kernel-qcow2-util-linux-8ce7dfa341fa969ba08438f97b0d875dbb78d75d.tar.xz kernel-qcow2-util-linux-8ce7dfa341fa969ba08438f97b0d875dbb78d75d.zip |
su: preserve errno in cleanup_pam()
Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
Diffstat (limited to 'login-utils/su.c')
-rw-r--r-- | login-utils/su.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/login-utils/su.c b/login-utils/su.c index 944d6558e..0f535b9b7 100644 --- a/login-utils/su.c +++ b/login-utils/su.c @@ -153,6 +153,8 @@ static struct pam_conv conv = static void cleanup_pam (int retcode) { + int saved_errno = errno; + if (_pam_session_opened) pam_close_session (pamh, 0); @@ -160,6 +162,8 @@ cleanup_pam (int retcode) pam_setcred (pamh, PAM_DELETE_CRED | PAM_SILENT); pam_end(pamh, retcode); + + errno = saved_errno; } /* Signal handler for parent process. */ |