diff options
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | openbsd-compat/Makefile.in | 2 | ||||
-rw-r--r-- | openbsd-compat/bsd-flock.c | 11 | ||||
-rw-r--r-- | openbsd-compat/bsd-misc.h | 8 |
4 files changed, 18 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac index a70d40628..35e2e8d1d 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -1723,6 +1723,7 @@ AC_CHECK_FUNCS([ \ | |||
1723 | explicit_bzero \ | 1723 | explicit_bzero \ |
1724 | fchmod \ | 1724 | fchmod \ |
1725 | fchown \ | 1725 | fchown \ |
1726 | flock \ | ||
1726 | freeaddrinfo \ | 1727 | freeaddrinfo \ |
1727 | freezero \ | 1728 | freezero \ |
1728 | fstatfs \ | 1729 | fstatfs \ |
diff --git a/openbsd-compat/Makefile.in b/openbsd-compat/Makefile.in index 053f2ef2a..71fcdb127 100644 --- a/openbsd-compat/Makefile.in +++ b/openbsd-compat/Makefile.in | |||
@@ -16,7 +16,7 @@ LDFLAGS=-L. @LDFLAGS@ | |||
16 | 16 | ||
17 | OPENBSD=base64.o basename.o bcrypt_pbkdf.o bindresvport.o blowfish.o daemon.o dirname.o fmt_scaled.o getcwd.o getgrouplist.o getopt_long.o getrrsetbyname.o glob.o inet_aton.o inet_ntoa.o inet_ntop.o mktemp.o pwcache.o readpassphrase.o reallocarray.o realpath.o recallocarray.o rresvport.o setenv.o setproctitle.o sha1.o sha2.o rmd160.o md5.o sigact.o strcasestr.o strlcat.o strlcpy.o strmode.o strnlen.o strptime.o strsep.o strtonum.o strtoll.o strtoul.o strtoull.o timingsafe_bcmp.o vis.o blowfish.o bcrypt_pbkdf.o explicit_bzero.o freezero.o | 17 | OPENBSD=base64.o basename.o bcrypt_pbkdf.o bindresvport.o blowfish.o daemon.o dirname.o fmt_scaled.o getcwd.o getgrouplist.o getopt_long.o getrrsetbyname.o glob.o inet_aton.o inet_ntoa.o inet_ntop.o mktemp.o pwcache.o readpassphrase.o reallocarray.o realpath.o recallocarray.o rresvport.o setenv.o setproctitle.o sha1.o sha2.o rmd160.o md5.o sigact.o strcasestr.o strlcat.o strlcpy.o strmode.o strnlen.o strptime.o strsep.o strtonum.o strtoll.o strtoul.o strtoull.o timingsafe_bcmp.o vis.o blowfish.o bcrypt_pbkdf.o explicit_bzero.o freezero.o |
18 | 18 | ||
19 | COMPAT=arc4random.o bsd-asprintf.o bsd-closefrom.o bsd-cygwin_util.o bsd-getpeereid.o getrrsetbyname-ldns.o bsd-err.o bsd-getpagesize.o bsd-misc.o bsd-nextstep.o bsd-openpty.o bsd-poll.o bsd-malloc.o bsd-setres_id.o bsd-signal.o bsd-snprintf.o bsd-statvfs.o bsd-waitpid.o fake-rfc2553.o openssl-compat.o xcrypt.o kludge-fd_set.o | 19 | COMPAT=arc4random.o bsd-asprintf.o bsd-closefrom.o bsd-cygwin_util.o bsd-getpeereid.o getrrsetbyname-ldns.o bsd-err.o bsd-flock.o bsd-getpagesize.o bsd-misc.o bsd-nextstep.o bsd-openpty.o bsd-poll.o bsd-malloc.o bsd-setres_id.o bsd-signal.o bsd-snprintf.o bsd-statvfs.o bsd-waitpid.o fake-rfc2553.o openssl-compat.o xcrypt.o kludge-fd_set.o |
20 | 20 | ||
21 | PORTS=port-aix.o port-irix.o port-linux.o port-solaris.o port-net.o port-uw.o | 21 | PORTS=port-aix.o port-irix.o port-linux.o port-solaris.o port-net.o port-uw.o |
22 | 22 | ||
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 | ||
43 | int flock(int fd, int op) { | 43 | int |
44 | flock(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; |
diff --git a/openbsd-compat/bsd-misc.h b/openbsd-compat/bsd-misc.h index af2ccdae2..2a73ae45b 100644 --- a/openbsd-compat/bsd-misc.h +++ b/openbsd-compat/bsd-misc.h | |||
@@ -145,4 +145,12 @@ int raise(int); | |||
145 | pid_t getsid(pid_t); | 145 | pid_t getsid(pid_t); |
146 | #endif | 146 | #endif |
147 | 147 | ||
148 | #ifndef HAVE_FLOCK | ||
149 | # define LOCK_SH 0x01 | ||
150 | # define LOCK_EX 0x02 | ||
151 | # define LOCK_NB 0x04 | ||
152 | # define LOCK_UN 0x08 | ||
153 | int flock(int, int); | ||
154 | #endif | ||
155 | |||
148 | #endif /* _BSD_MISC_H */ | 156 | #endif /* _BSD_MISC_H */ |