From cd3ab57f9b388f8b1abf601dc4d78ff82d83b75e Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Mon, 26 Feb 2018 14:37:06 +1100 Subject: 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. --- openbsd-compat/bsd-flock.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'openbsd-compat/bsd-flock.c') 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 @@ * Otherwise, don't do locking; just pretend success. */ -#include "nbtool_config.h" +#include "includes.h" -#if !HAVE_FLOCK +#ifndef HAVE_FLOCK #include #include -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 @@ int flock(int fd, int op) { if (rc && (errno == EAGAIN)) errno = EWOULDBLOCK; +#else + rc = -1 + errno = ENOSYS; #endif return rc; -- cgit v1.2.3