From: Volker Lendecke Date: Fri, 20 Nov 2020 13:19:21 +0000 (+0100) Subject: build: Fix kernel oplock test X-Git-Tag: samba-4.14.0rc1~508 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a8d2654d52bd8539eb73cafe9da5666aad7c7d50;p=thirdparty%2Fsamba.git build: Fix kernel oplock test In a pure docker environment with overlayfs F_GETLEASE works on /tmp, but F_SETLEASE does not. This test now correctly detects that. The effect is that the samba-fileserver environment would run fine in a shared gitlab runner, at the price of not testing kernel oplocks. We could move the kernel oplock tests to another environment that for other reasons can't run on shared gitlab runners. Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/wscript b/source3/wscript index 011594b3844..a370fae667f 100644 --- a/source3/wscript +++ b/source3/wscript @@ -184,8 +184,12 @@ main() { #ifndef F_GETLEASE #define F_GETLEASE 1025 #endif -main() { - exit(fcntl(open("/tmp", O_RDONLY), F_GETLEASE, 0) == -1 ? 1 : 0); +int main() { + const char *fname="/tmp/oplock-test.txt"; + int fd = open(fname, O_RDWR|O_CREAT, 0644); + int ret = fcntl(fd, F_SETLEASE, F_WRLCK); + unlink(fname); + return (ret == -1) ? 1 : 0; }''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain=False, execute=True, msg="Checking for Linux kernel oplocks")