In file-not-found case, report the filename sought
authorKen Raeburn <raeburn@mit.edu>
Wed, 4 Jul 2007 03:49:52 +0000 (03:49 +0000)
committerKen Raeburn <raeburn@mit.edu>
Wed, 4 Jul 2007 03:49:52 +0000 (03:49 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19665 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/keytab/kt_file.c

index fe44ff65ea945fef8e3ed163464f940a76ee13cc..df0a80501f4241ab22232de678357b2fb3904149 100644 (file)
@@ -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));