Hook up flock() compat code.

Also a couple of minor changes: fail if we can't lock instead of
silently succeeding, and apply a couple of minor style fixes.
diff --git a/configure.ac b/configure.ac
index a70d406..35e2e8d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1723,6 +1723,7 @@
 	explicit_bzero \
 	fchmod \
 	fchown \
+	flock \
 	freeaddrinfo \
 	freezero \
 	fstatfs \
diff --git a/openbsd-compat/Makefile.in b/openbsd-compat/Makefile.in
index 053f2ef..71fcdb1 100644
--- a/openbsd-compat/Makefile.in
+++ b/openbsd-compat/Makefile.in
@@ -16,7 +16,7 @@
 
 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
 
-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
+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
 
 PORTS=port-aix.o port-irix.o port-linux.o port-solaris.o port-net.o port-uw.o
 
diff --git a/openbsd-compat/bsd-flock.c b/openbsd-compat/bsd-flock.c
index 4a51ebe..bf4d8a6 100644
--- a/openbsd-compat/bsd-flock.c
+++ b/openbsd-compat/bsd-flock.c
@@ -34,13 +34,15 @@
  * Otherwise, don't do locking; just pretend success.
  */
 
-#include "nbtool_config.h"
+#include "includes.h"
 
-#if !HAVE_FLOCK
+#ifndef HAVE_FLOCK
 #include <errno.h>
 #include <fcntl.h>
 
-int flock(int fd, int op) {
+int
+flock(int fd, int op)
+{
 	int rc = 0;
 
 #if defined(F_SETLK) && defined(F_SETLKW)
@@ -69,6 +71,9 @@
 
 	if (rc && (errno == EAGAIN))
 		errno = EWOULDBLOCK;
+#else
+	rc = -1
+	errno = ENOSYS;
 #endif
 
 	return rc;
diff --git a/openbsd-compat/bsd-misc.h b/openbsd-compat/bsd-misc.h
index af2ccda..2a73ae4 100644
--- a/openbsd-compat/bsd-misc.h
+++ b/openbsd-compat/bsd-misc.h
@@ -145,4 +145,12 @@
 pid_t getsid(pid_t);
 #endif
 
+#ifndef HAVE_FLOCK
+# define LOCK_SH		0x01
+# define LOCK_EX		0x02
+# define LOCK_NB		0x04
+# define LOCK_UN		0x08
+int flock(int, int);
+#endif
+
 #endif /* _BSD_MISC_H */