Fix ENOENT msg clobbering in fcache.c

By not returning the same error code as we were setting on the context,
the error message was subsequently lost.
This commit is contained in:
Nicolas Williams
2015-04-01 19:25:55 -05:00
parent a3b5dc2e34
commit 617a82a0a5

View File

@@ -426,7 +426,7 @@ again:
return EPERM;
}
} else if (errno != ENOENT || !(flags & O_CREAT)) {
krb5_set_error_message(context, ret, N_("%s lstat(%s)", "file, error"),
krb5_set_error_message(context, errno, N_("%s lstat(%s)", "file, error"),
operation, filename);
return errno;
}
@@ -1009,13 +1009,8 @@ out:
if (fd > -1) {
fcc_unlock(context, fd);
if (close(fd) < 0 && ret == 0) {
char buf[128];
/* This error might be useful */
rk_strerror_r(ret, buf, sizeof(buf));
ret = errno;
krb5_set_error_message(context, ret, N_("close %s: %s", ""),
FILENAME(id), buf);
krb5_set_error_message(context, errno, N_("close %s", ""),
FILENAME(id));
}
}
krb5_data_free(&orig_cred_data);