[PATCH] flopen: fix build with musl libc

Baruch Siach baruch at tkos.co.il
Tue Jun 5 16:27:55 UTC 2018

Commit 993828d84ee (Add flopenat() function from FreeBSD) dropped the
fcntl.h header. This breaks the build with musl libc:

flopen.c: In function ‘vflopenat’:
flopen.c:60:14: error: ‘O_CREAT’ undeclared (first use in this function)
  if (flags & O_CREAT) {

Restore the fcntl.h header include to fix the build.

Signed-off-by: Baruch Siach <baruch at tkos.co.il>
 src/flopen.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/flopen.c b/src/flopen.c
index b9972c94ec90..ff20d074445b 100644
--- a/src/flopen.c
+++ b/src/flopen.c
@@ -32,6 +32,7 @@
 #include <sys/stat.h>
 #include <errno.h>
+#include <fcntl.h>
 #include <stdarg.h>
 #include <unistd.h>

More information about the libbsd mailing list