Skip to content
Snippets Groups Projects
Commit 4e733cf0 authored by Ben Collins's avatar Ben Collins
Browse files

Macros for file locking/unlocking added (ldap_lockf/ldap_unlockf)

parent 9d2ea940
No related branches found
No related tags found
No related merge requests found
......@@ -54,4 +54,23 @@ extern char* getpass LDAP_P((const char *getpass));
/* use _POSIX_VERSION for POSIX.1 code */
/* Setup file locking macros */
#if HAVE_LOCKF
# define ldap_lockf(x) lockf(fileno(x),F_LOCK, 0)
# define ldap_unlockf(x) lockf(fileno(x),F_ULOCK, 0)
#elif HAVE_FCNTL_H
# ifndef NEED_FCNTL_LOCKING
# define NEED_FCNTL_LOCKING
# endif
# include <lutil_lockf.h>
# define ldap_lockf(x) lutil_ldap_lockf(x)
# define ldap_unlockf(x) lutil_ldap_unlockf(x)
#elif HAVE_FLOCK
# if HAVE_SYS_FILE_H
# include <sys/file.h>
# endif
# define ldap_lockf(x) flock(fileno(x),LOCK_EX)
# define ldap_unlockf(x) flock(fileno(x),LOCK_UN)
#endif
#endif /* _AC_UNISTD_H */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment