From 9628d1b4031052585edb661a482ab01bc4b2bdaa Mon Sep 17 00:00:00 2001 From: Benny Goemans <12911845+malavon@users.noreply.github.com> Date: Sun, 12 May 2019 22:43:42 +0200 Subject: [PATCH] Fixed unforeseen definition of O_LARGEFILE=1 By setting -DO_LARGEFILE on the cmake command line, it is actually the same as setting -DO_LARGEFILE=1. Since this constant is used inside code to set flags, a file would be opened with both READ_ONLY and READ_WRITE flag set. This of course will not be allowed by the kernel --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c37c74a40..56bf70f99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,7 +37,7 @@ endif() if(${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD) set(ASAN OFF) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DO_LARGEFILE -Dstat64=stat -Dlstat64=lstat -Dlseek64=lseek -Doff64_t=off_t -Dfstat64=fstat -Dftruncate64=ftruncate") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DO_LARGEFILE=0 -Dstat64=stat -Dlstat64=lstat -Dlseek64=lseek -Doff64_t=off_t -Dfstat64=fstat -Dftruncate64=ftruncate") endif() if(WIN32)