diff options
author | Damien Miller <djm@mindrot.org> | 2012-04-26 09:52:15 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2012-04-26 09:52:15 +1000 |
commit | 025bfd11d987b62ecfe3283acfd21933222d4330 (patch) | |
tree | 01624d7f037ae2b1cc3f0e60f22abacdbc7afd59 /auth-krb5.c | |
parent | 7584cb1ac4daafbfb3dec592dd7ef48b81d20eea (diff) |
- (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.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/auth-krb5.c b/auth-krb5.c index d019fe202..922c66c66 100644 --- a/auth-krb5.c +++ b/auth-krb5.c | |||
@@ -226,7 +226,7 @@ krb5_cleanup_proc(Authctxt *authctxt) | |||
226 | #ifndef HEIMDAL | 226 | #ifndef HEIMDAL |
227 | krb5_error_code | 227 | krb5_error_code |
228 | ssh_krb5_cc_gen(krb5_context ctx, krb5_ccache *ccache) { | 228 | ssh_krb5_cc_gen(krb5_context ctx, krb5_ccache *ccache) { |
229 | int tmpfd, ret; | 229 | int tmpfd, ret, oerrno; |
230 | char ccname[40]; | 230 | char ccname[40]; |
231 | mode_t old_umask; | 231 | mode_t old_umask; |
232 | 232 | ||
@@ -237,16 +237,18 @@ ssh_krb5_cc_gen(krb5_context ctx, krb5_ccache *ccache) { | |||
237 | 237 | ||
238 | old_umask = umask(0177); | 238 | old_umask = umask(0177); |
239 | tmpfd = mkstemp(ccname + strlen("FILE:")); | 239 | tmpfd = mkstemp(ccname + strlen("FILE:")); |
240 | oerrno = errno; | ||
240 | umask(old_umask); | 241 | umask(old_umask); |
241 | if (tmpfd == -1) { | 242 | if (tmpfd == -1) { |
242 | logit("mkstemp(): %.100s", strerror(errno)); | 243 | logit("mkstemp(): %.100s", strerror(oerrno)); |
243 | return errno; | 244 | return oerrno; |
244 | } | 245 | } |
245 | 246 | ||
246 | if (fchmod(tmpfd,S_IRUSR | S_IWUSR) == -1) { | 247 | if (fchmod(tmpfd,S_IRUSR | S_IWUSR) == -1) { |
247 | logit("fchmod(): %.100s", strerror(errno)); | 248 | oerrno = errno; |
249 | logit("fchmod(): %.100s", strerror(oerrno)); | ||
248 | close(tmpfd); | 250 | close(tmpfd); |
249 | return errno; | 251 | return oerrno; |
250 | } | 252 | } |
251 | close(tmpfd); | 253 | close(tmpfd); |
252 | 254 | ||