From 3dd4257f88faca5e18f4eb633fe444f1b0d6d82f Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Fri, 28 Apr 1995 20:36:57 +0000 Subject: [PATCH] configure.in: Add check for KRB5_POSIX_LOCKS krb_dbm.c: Add #include of fcntl.h; if POSIX_FILE_LOCKS is defined, use POSIX-style locking. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5634 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/kdb4/ChangeLog | 7 +++++++ src/lib/kdb4/configure.in | 1 + src/lib/kdb4/krb_dbm.c | 17 +++++++++-------- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/lib/kdb4/ChangeLog b/src/lib/kdb4/ChangeLog index a9cd53496..f27dddc80 100644 --- a/src/lib/kdb4/ChangeLog +++ b/src/lib/kdb4/ChangeLog @@ -1,3 +1,10 @@ +Fri Apr 28 16:24:20 1995 Theodore Y. Ts'o + + * configure.in: Add check for KRB5_POSIX_LOCKS + + * krb_dbm.c: Add #include of fcntl.h; if POSIX_FILE_LOCKS is + defined, use POSIX-style locking. + Fri Jan 13 18:24:26 1995 Ian Lance Taylor * krb_kdb_utils.c (kdb_verify_master_key): Don't say ``BEWARE!'', diff --git a/src/lib/kdb4/configure.in b/src/lib/kdb4/configure.in index 0f69f3b44..c9f3fe7e3 100644 --- a/src/lib/kdb4/configure.in +++ b/src/lib/kdb4/configure.in @@ -11,6 +11,7 @@ AC_PROG_INSTALL AC_HEADER_CHECK(ndbm.h,AC_DEFINE(NDBM)) AC_CONST CHECK_FCNTL +KRB5_POSIX_LOCKS AC_HEADER_CHECK(unistd.h,AC_DEFINE(HAS_UNISTD_H)) ET_RULES SubdirLibraryRule([$(OBJS)]) diff --git a/src/lib/kdb4/krb_dbm.c b/src/lib/kdb4/krb_dbm.c index c67c020ba..bf3ede81f 100644 --- a/src/lib/kdb4/krb_dbm.c +++ b/src/lib/kdb4/krb_dbm.c @@ -17,6 +17,7 @@ #include #include #include +#include /* before krb_db.h */ #include #include @@ -27,7 +28,7 @@ #include #endif /*NDBM*/ -#ifdef POSIX +#ifdef POSIX_FILE_LOCKS #include #endif @@ -730,7 +731,7 @@ static void kerb_dbl_fini() static int kerb_dbl_lock(mode) int mode; { -#ifdef POSIX +#ifdef POSIX_FILE_LOCKS struct flock f; int rv; #else @@ -745,13 +746,13 @@ static int kerb_dbl_lock(mode) fflush(stderr); exit(1); } -#ifdef POSIX +#ifdef POSIX_FILE_LOCKS memset(&f, 0, sizeof(f)); #endif switch (mode) { case KERB_DBL_EXCLUSIVE: -#ifdef POSIX +#ifdef POSIX_FILE_LOCKS f.l_type = F_WRLCK; #else flock_mode = LOCK_EX; @@ -759,7 +760,7 @@ static int kerb_dbl_lock(mode) break; case KERB_DBL_SHARED: -#ifdef POSIX +#ifdef POSIX_FILE_LOCKS f.l_type = F_RDLCK; #else flock_mode = LOCK_SH; @@ -771,7 +772,7 @@ static int kerb_dbl_lock(mode) abort(); } -#ifdef POSIX +#ifdef POSIX_FILE_LOCKS if (non_blocking) rv = fcntl (dblfd, F_SETLK, &f); else @@ -791,7 +792,7 @@ static int kerb_dbl_lock(mode) static void kerb_dbl_unlock() { -#ifdef POSIX +#ifdef POSIX_FILE_LOCKS struct flock f; #endif @@ -800,7 +801,7 @@ static void kerb_dbl_unlock() fflush(stderr); exit(1); } -#ifdef POSIX +#ifdef POSIX_FILE_LOCKS memset(&f, 0, sizeof (f)); f.l_type = F_UNLCK; if (fcntl(dblfd, F_SETLK, &f) < 0) { -- 2.26.2