add defines for vno and open flags
authorJohn Kohl <jtkohl@mit.edu>
Tue, 12 Feb 1991 14:08:47 +0000 (14:08 +0000)
committerJohn Kohl <jtkohl@mit.edu>
Tue, 12 Feb 1991 14:08:47 +0000 (14:08 +0000)
add macros for MAYBE_OPEN/CLOSE

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1672 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/ccache/file/fcc.h

index 07ca0a76f1827ab29caeb9aac72c2a062d235579..c310b1c93ed16303dacc28876e94932eb2ddf7ec 100644 (file)
@@ -3,7 +3,7 @@
  * $Author$
  * $Id$
  *
- * Copyright 1990 by the Massachusetts Institute of Technology.
+ * Copyright 1990,1991 by the Massachusetts Institute of Technology.
  *
  * For copying and distribution information, please see the file
  * <krb5/copyright.h>.
 
 #define KRB5_FCC_MAXLEN 100
 
+#define KRB5_FCC_FVNO 0x0501           /* krb v5, fcc v1 */
+#define        FCC_OPEN_AND_ERASE      1
+#define        FCC_OPEN_RDWR           2
+#define        FCC_OPEN_RDONLY         3
+
 #ifndef TKT_ROOT
 #define TKT_ROOT "/tmp/tkt"
 #endif
@@ -45,5 +50,22 @@ typedef struct _krb5_fcc_cursor {
      off_t pos;
 } krb5_fcc_cursor;
 
+#define MAYBE_OPEN(ID, MODE) \
+{                                                                      \
+    if (OPENCLOSE (ID)) {                                              \
+       krb5_error_code maybe_open_ret = krb5_fcc_open_file (ID,MODE);  \
+       if (maybe_open_ret) return maybe_open_ret; } }
+
+#define MAYBE_CLOSE(ID, RET) \
+{                                                                      \
+    if (OPENCLOSE (ID)) {                                              \
+       krb5_error_code maybe_close_ret = krb5_fcc_close_file (ID);     \
+       if (!(RET)) RET = maybe_close_ret; } }
+
+#define MAYBE_CLOSE_IGNORE(ID) \
+{                                                                      \
+    if (OPENCLOSE (ID)) {                                              \
+       (void) krb5_fcc_close_file (ID); } }
+
 /* DO NOT ADD ANYTHING AFTER THIS #endif */
 #endif /* __KRB5_FILE_CCACHE__ */