]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
su: preserve errno in cleanup_pam()
authorLudwig Nussel <ludwig.nussel@suse.de>
Tue, 5 Jun 2012 13:31:24 +0000 (15:31 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 5 Jun 2012 13:51:26 +0000 (15:51 +0200)
Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
login-utils/su.c

index 944d6558e8a24bdbed22c5bed1bfade13876290f..0f535b9b728cfb3d3327f89756842b6b654f24ed 100644 (file)
@@ -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.  */