[PATCH] su: preserve errno in cleanup_pam()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Ludwig Nussel <ludwig.nussel@xxxxxxx>
---
 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 944d655..0f535b9 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.  */
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux