summaryrefslogtreecommitdiff
path: root/openbsd-compat/bsd-flock.c
diff options
context:
space:
mode:
Diffstat (limited to 'openbsd-compat/bsd-flock.c')
-rw-r--r--openbsd-compat/bsd-flock.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/openbsd-compat/bsd-flock.c b/openbsd-compat/bsd-flock.c
index 4a51ebe13..bf4d8a658 100644
--- a/openbsd-compat/bsd-flock.c
+++ b/openbsd-compat/bsd-flock.c
@@ -34,13 +34,15 @@
34 * Otherwise, don't do locking; just pretend success. 34 * Otherwise, don't do locking; just pretend success.
35 */ 35 */
36 36
37#include "nbtool_config.h" 37#include "includes.h"
38 38
39#if !HAVE_FLOCK 39#ifndef HAVE_FLOCK
40#include <errno.h> 40#include <errno.h>
41#include <fcntl.h> 41#include <fcntl.h>
42 42
43int flock(int fd, int op) { 43int
44flock(int fd, int op)
45{
44 int rc = 0; 46 int rc = 0;
45 47
46#if defined(F_SETLK) && defined(F_SETLKW) 48#if defined(F_SETLK) && defined(F_SETLKW)
@@ -69,6 +71,9 @@ int flock(int fd, int op) {
69 71
70 if (rc && (errno == EAGAIN)) 72 if (rc && (errno == EAGAIN))
71 errno = EWOULDBLOCK; 73 errno = EWOULDBLOCK;
74#else
75 rc = -1
76 errno = ENOSYS;
72#endif 77#endif
73 78
74 return rc; 79 return rc;