+2004-06-15 Ken Raeburn <raeburn@mit.edu>
+
+ * rc_io.c (dir, dirlen): Top-level variables deleted.
+ (getdir): Now returns the pointer, doesn't set top-level
+ variables.
+ (GETDIR): Set local variables dir and dirlen using the function's
+ return value.
+ (krb5_rc_io_creat, krb5_rc_io_open_internal): Add the new local
+ variables.
+
2004-06-02 Ken Raeburn <raeburn@mit.edu>
* rc-int.h (struct krb5_rc_st, struct _krb5_rc_ops, krb5_rc_ops):
#define FREE(x) ((void) free((char *) (x)))
#define UNIQUE getpid() /* hopefully unique number */
-static unsigned int dirlen = 0;
-static char *dir;
+#define GETDIR (dir = getdir(), dirlen = strlen(dir) + sizeof(PATH_SEPARATOR) - 1)
-/* The do ... while(0) is required to insure that GETDIR looks like a
- single statement in all situations (just {}'s may cause troubles in
- certain situations, such as nested if/else clauses. */
-
-#define GETDIR do { if (!dirlen) getdir(); } while(0)
-
-static void
+static char *
getdir(void)
{
+ char *dir;
+
if (!(dir = getenv("KRB5RCACHEDIR"))) {
#if defined(_WIN32)
if (!(dir = getenv("TEMP")))
}
#endif
}
- dirlen = strlen(dir) + sizeof(PATH_SEPARATOR) - 1;
+ return dir;
}
krb5_error_code
krb5_int16 rc_vno = htons(KRB5_RC_VNO);
krb5_error_code retval = 0;
int do_not_unlink = 0;
+ char *dir;
+ size_t dirlen;
GETDIR;
if (fn && *fn)
#ifndef NO_USERID
struct stat statb;
#endif
+ char *dir;
+ size_t dirlen;
GETDIR;
if (full_pathname) {