summaryrefslogtreecommitdiff
path: root/auth-krb5.c
diff options
context:
space:
mode:
authordjm <djm>2012-04-25 23:52:15 +0000
committerdjm <djm>2012-04-25 23:52:15 +0000
commit9381a8e77ce7d4bc6211f73e2bdc3ca1fca6c2fa (patch)
tree34d0ad48b320dd215d77666891e0880b05a22859 /auth-krb5.c
parent665184632b73495a82871b56cd99bc2ca510a8d7 (diff)
downloadopenssh-9381a8e77ce7d4bc6211f73e2bdc3ca1fca6c2fa.tar.gz
- (djm) [auth-krb5.c] Save errno across calls that might modify it;
ok dtucker@
Diffstat (limited to 'auth-krb5.c')
-rw-r--r--auth-krb5.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/auth-krb5.c b/auth-krb5.c
index d019fe20..922c66c6 100644
--- a/auth-krb5.c
+++ b/auth-krb5.c
@@ -226,7 +226,7 @@ krb5_cleanup_proc(Authctxt *authctxt)
#ifndef HEIMDAL
krb5_error_code
ssh_krb5_cc_gen(krb5_context ctx, krb5_ccache *ccache) {
- int tmpfd, ret;
+ int tmpfd, ret, oerrno;
char ccname[40];
mode_t old_umask;
@@ -237,16 +237,18 @@ ssh_krb5_cc_gen(krb5_context ctx, krb5_ccache *ccache) {
old_umask = umask(0177);
tmpfd = mkstemp(ccname + strlen("FILE:"));
+ oerrno = errno;
umask(old_umask);
if (tmpfd == -1) {
- logit("mkstemp(): %.100s", strerror(errno));
- return errno;
+ logit("mkstemp(): %.100s", strerror(oerrno));
+ return oerrno;
}
if (fchmod(tmpfd,S_IRUSR | S_IWUSR) == -1) {
- logit("fchmod(): %.100s", strerror(errno));
+ oerrno = errno;
+ logit("fchmod(): %.100s", strerror(oerrno));
close(tmpfd);
- return errno;
+ return oerrno;
}
close(tmpfd);