+2004-11-23 Tom Yu <tlyu@mit.edu>
+
+ * kt_file.c (krb5_ktfileint_open): Update previous change by
+ explicitly setting errno=0 prior to calling fopen(). Also, return
+ EMFILE, not ENFILE, for compatibility with Solaris 8, which does
+ set errno when out of file descriptors.
+
2004-11-19 Tom Yu <tlyu@mit.edu>
* kt_file.c (krb5_ktfileint_open): Patch from Roland Dowdeswell to
krb5_kt_vno kt_vno;
int writevno = 0;
+ errno = 0;
KTFILEP(id) = fopen(KTFILENAME(id),
(mode == KRB5_LOCKMODE_EXCLUSIVE) ?
fopen_mode_rbplus : fopen_mode_rb);
if ((mode == KRB5_LOCKMODE_EXCLUSIVE) && (errno == ENOENT)) {
/* try making it first time around */
krb5_create_secure_file(context, KTFILENAME(id));
+ errno = 0;
KTFILEP(id) = fopen(KTFILENAME(id), fopen_mode_rbplus);
if (!KTFILEP(id))
- return errno ? errno : ENFILE;
+ return errno ? errno : EMFILE;
writevno = 1;
} else /* some other error */
- return errno ? errno : ENFILE;
+ return errno ? errno : EMFILE;
}
if ((kerror = krb5_lock_file(context, fileno(KTFILEP(id)), mode))) {
(void) fclose(KTFILEP(id));