add error code interpretation
authorJohn Kohl <jtkohl@mit.edu>
Fri, 31 Aug 1990 14:59:50 +0000 (14:59 +0000)
committerJohn Kohl <jtkohl@mit.edu>
Fri, 31 Aug 1990 14:59:50 +0000 (14:59 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1072 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/ccache/file/fcc_init.c

index a422505e1b0f9906eb7d077d3456c780cef22ab2..248ef0620edcd38391b7081714f12f6f49246915 100644 (file)
@@ -40,13 +40,18 @@ krb5_fcc_initialize(id, princ)
      ret = open(((krb5_fcc_data *) id->data)->filename, O_CREAT | O_TRUNC |
                O_RDWR, 0);
      if (ret < 0)
-         return errno;
+         return krb5_fcc_interpret(errno);
      ((krb5_fcc_data *) id->data)->fd = ret;
 
      ret = fchmod(((krb5_fcc_data *) id->data)->fd, S_IREAD | S_IWRITE);
-     if (ret == -1)
-         return ret;
-
+     if (ret == -1) {
+        ret = krb5_fcc_interpret(errno);
+        if (OPENCLOSE(id)) {
+            close(((krb5_fcc_data *)id->data)->fd);
+            ((krb5_fcc_data *) id->data)->fd = -1;
+        }
+        return ret;
+     }
      krb5_fcc_store_principal(id, princ);
 
      if (OPENCLOSE(id)) {