git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@646 dc483132-0cff-0310-8789-dd5450dbe970
authorJohn Kohl <jtkohl@mit.edu>
Tue, 1 May 1990 17:03:54 +0000 (17:03 +0000)
committerJohn Kohl <jtkohl@mit.edu>
Tue, 1 May 1990 17:03:54 +0000 (17:03 +0000)
src/lib/krb5/ccache/file/fcc_gprin.c

index ef0044ca1289e46bb8abeaa453449104d383ff87..59177704298eba78f2bb8ad3ce4cf9a8111fe78f 100644 (file)
@@ -38,19 +38,20 @@ krb5_fcc_get_principal(id, princ)
      krb5_error_code kret;
 
      if (OPENCLOSE(id)) {
-         ((krb5_fcc_data *) id->data)->fd = open(((krb5_fcc_data *) id->data)
-                                                 ->filename, O_RDONLY, 0);
-         if (((krb5_fcc_data *) id->data)->fd < 0)
+         kret = open(((krb5_fcc_data *) id->data)->filename, O_RDONLY, 0);
+         if (kret < 0)
               return errno;
+         ((krb5_fcc_data *) id->data)->fd = kret;
      }
      else
          lseek(((krb5_fcc_data *) id->data)->fd, 0, L_SET);
 
      kret = krb5_fcc_read_principal(id, princ);
 
-     if (OPENCLOSE(id))
+     if (OPENCLOSE(id)) {
          close(((krb5_fcc_data *) id->data)->fd);
-
+         ((krb5_fcc_data *) id->data)->fd = -1;
+     }
      return kret;
 }