From 743ecf4a6688efb9230fd739a4dcdb90e9cd51f8 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Wed, 4 Jul 2007 03:49:52 +0000 Subject: [PATCH] In file-not-found case, report the filename sought git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19665 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/keytab/kt_file.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/lib/krb5/keytab/kt_file.c b/src/lib/krb5/keytab/kt_file.c index fe44ff65e..df0a80501 100644 --- a/src/lib/krb5/keytab/kt_file.c +++ b/src/lib/krb5/keytab/kt_file.c @@ -1,7 +1,7 @@ /* * lib/krb5/keytab/kt_file.c * - * Copyright 1990,1991,1995 by the Massachusetts Institute of Technology. + * Copyright 1990,1991,1995,2007 by the Massachusetts Institute of Technology. * All Rights Reserved. * * Export of this software from the United States of America may @@ -1068,10 +1068,23 @@ krb5_ktfileint_open(krb5_context context, krb5_keytab id, int mode) errno = 0; KTFILEP(id) = fopen(KTFILENAME(id), fopen_mode_rbplus); if (!KTFILEP(id)) - return errno ? errno : EMFILE; + goto report_errno; writevno = 1; - } else /* some other error */ - return errno ? errno : EMFILE; + } else { + report_errno: + switch (errno) { + case 0: + /* XXX */ + return EMFILE; + case ENOENT: + krb5_set_error_message(context, ENOENT, + "Key table file '%s' not found", + KTFILENAME(id)); + return ENOENT; + default: + return errno; + } + } } if ((kerror = krb5_lock_file(context, fileno(KTFILEP(id)), mode))) { (void) fclose(KTFILEP(id)); -- 2.26.2