From de2dc728326ea2953cc6e8c9cb531f8443b12e55 Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Thu, 21 Dec 1995 23:25:19 +0000 Subject: [PATCH] * configure.in: Check for the stat call, since profile_update_file needs to know whether it exists. (It doesn't on the Mac.) * prof_file.c (profile_update_file): Change use of HAS_STAT to HAVE_STAT, to confirm with autoconf test. If the stat() call does not exist, assume that our in-core memory image is correct, and never re-read the profile file unless we explicitly close it. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7242 dc483132-0cff-0310-8789-dd5450dbe970 --- src/util/profile/ChangeLog | 11 +++++++++++ src/util/profile/configure.in | 1 + src/util/profile/prof_file.c | 16 ++++++++++++---- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/util/profile/ChangeLog b/src/util/profile/ChangeLog index bbeb16db1..908c22695 100644 --- a/src/util/profile/ChangeLog +++ b/src/util/profile/ChangeLog @@ -1,3 +1,14 @@ +Thu Dec 21 18:20:46 1995 Theodore Y. Ts'o + + * configure.in: Check for the stat call, since profile_update_file + needs to know whether it exists. (It doesn't on the Mac.) + + * prof_file.c (profile_update_file): Change use of HAS_STAT to + HAVE_STAT, to confirm with autoconf test. If the stat() + call does not exist, assume that our in-core memory image + is correct, and never re-read the profile file unless we + explicitly close it. + Fri Oct 6 22:07:01 1995 Theodore Y. Ts'o * Makefile.in: Remove ##DOS!include of config/windows.in. diff --git a/src/util/profile/configure.in b/src/util/profile/configure.in index f58fe61a8..100df4529 100644 --- a/src/util/profile/configure.in +++ b/src/util/profile/configure.in @@ -7,6 +7,7 @@ AC_PROG_RANLIB AC_CHECK_SIZEOF(short) AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(long) +AC_HAVE_FUNCS(stat) ET_RULES V5_SHARED_LIB_OBJS CopyHeader(profile.h,$(BUILDTOP)/include) diff --git a/src/util/profile/prof_file.c b/src/util/profile/prof_file.c index b0de1cd3a..468de74a8 100644 --- a/src/util/profile/prof_file.c +++ b/src/util/profile/prof_file.c @@ -53,19 +53,27 @@ errcode_t profile_update_file(prf) prf_file_t prf; { errcode_t retval; -#ifdef HAS_STAT +#ifdef HAVE_STAT struct stat st; #endif FILE *f; -#ifdef HAS_STAT +#ifdef HAVE_STAT if (stat(prf->filename, &st)) return errno; if (st.st_mtime == prf->timestamp) return 0; -#endif if (prf->root) profile_free_node(prf->root); +#else + /* + * If we don't have the stat() call, assume that our in-core + * memory image is correct. That is, we won't reread the + * profile file if it changes. + */ + if (prf->root) + return 0; +#endif f = fopen(prf->filename, "r"); if (f == NULL) return errno; @@ -73,7 +81,7 @@ errcode_t profile_update_file(prf) fclose(f); if (retval) return retval; -#ifdef HAS_STAT +#ifdef HAVE_STAT prf->timestamp = st.st_mtime; #endif return 0; -- 2.26.2