summaryrefslogtreecommitdiffstats
path: root/src/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/util.c b/src/util.c
index b421660..cda7468 100644
--- a/src/util.c
+++ b/src/util.c
@@ -15,7 +15,6 @@
*/
#define _POSIX_SOURCE 1 /* for wordexp, fileno */
-#define _BSD_SOURCE 1 /* for lockf */
#include <assert.h>
#include <errno.h>
@@ -28,6 +27,10 @@
#include <sys/types.h>
#include <unistd.h>
+#if defined(HAVE_FLOCK) && defined(HAVE_FILENO)
+# include <sys/file.h>
+#endif
+
#include "lilv_internal.h"
#ifdef HAVE_WORDEXP
@@ -354,8 +357,8 @@ lilv_path_is_child(const char* path, const char* dir)
int
lilv_flock(FILE* file, bool lock)
{
-#if defined(HAVE_LOCKF) && defined(HAVE_FILENO)
- return lockf(fileno(file), lock ? F_LOCK : F_ULOCK, 0);
+#if defined(HAVE_FLOCK) && defined(HAVE_FILENO)
+ return flock(fileno(file), lock ? LOCK_EX : LOCK_UN);
#else
return 0;
#endif