immediately instead of trying to do flock-style locking.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11024
dc483132-0cff-0310-8789-
dd5450dbe970
+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
#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>
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