diff options
| author | Theodore Tso <tytso@mit.edu> | 1998-11-13 20:33:59 +0000 |
|---|---|---|
| committer | Theodore Tso <tytso@mit.edu> | 1998-11-13 20:33:59 +0000 |
| commit | 2c7de2e92016292037da5c3a4668cce75b8516c6 (patch) | |
| tree | 4d5ae1e83c44d6919927b3c087c8b0c7944cd6e7 /src | |
| parent | 3eb57197bc7f72e6fe6b957accbb55c1a225e2bb (diff) | |
| download | krb5-2c7de2e92016292037da5c3a4668cce75b8516c6.tar.gz krb5-2c7de2e92016292037da5c3a4668cce75b8516c6.tar.xz krb5-2c7de2e92016292037da5c3a4668cce75b8516c6.zip | |
Fix bug where if the fcntl-style lock succeeded, we should return
immediately instead of trying to do flock-style locking.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11024 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/krb5/os/ChangeLog | 6 | ||||
| -rw-r--r-- | src/lib/krb5/os/lock_file.c | 9 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/lib/krb5/os/ChangeLog b/src/lib/krb5/os/ChangeLog index c8ea14f65..a1d7fa027 100644 --- a/src/lib/krb5/os/ChangeLog +++ b/src/lib/krb5/os/ChangeLog @@ -1,3 +1,9 @@ +1998-11-13 Theodore Ts'o <tytso@rsts-11.mit.edu> + + * lock_file.c (krb5_lock_file): Fix bug where if the fcntl-style + lock succeeded, we should return immediately instead of + trying to do flock-style locking. + 1998-10-31 Theodore Ts'o <tytso@rsts-11.mit.edu> * lock_file.c (krb5_lock_file): Move the flock() fallback code diff --git a/src/lib/krb5/os/lock_file.c b/src/lib/krb5/os/lock_file.c index eb8e76183..79c1f97f1 100644 --- a/src/lib/krb5/os/lock_file.c +++ b/src/lib/krb5/os/lock_file.c @@ -37,10 +37,14 @@ #include <errno.h> -#ifdef POSIX_FILE_LOCKS +#ifdef HAVE_FCNTL_H #include <fcntl.h> #endif +#if defined(HAVE_FCNTL_H) && defined(F_SETLKW) && defined(F_RDLCK) +#define POSIX_FILE_LOCKS +#endif + #ifdef HAVE_FLOCK #ifndef sysvimp #include <sys/file.h> @@ -114,7 +118,8 @@ krb5_lock_file(context, fd, mode) if (errno != EINVAL) /* Fall back to flock if we get EINVAL */ return(errno); retval = errno; - } + } else + return 0; /* We succeeded. Yay. */ #endif #ifdef HAVE_FLOCK |
