util.pposix: Fix building on non-Linux with glibc
authorKim Alvefur <zash@zash.se>
Mon, 02 Sep 2013 18:19:38 +0200
changeset 5812 57ebf93ec720
parent 5811 27ae988f5b70
child 5813 c888f548876b
util.pposix: Fix building on non-Linux with glibc
util-src/pposix.c
--- a/util-src/pposix.c	Fri Aug 30 18:51:55 2013 +0200
+++ b/util-src/pposix.c	Mon Sep 02 18:19:38 2013 +0200
@@ -36,7 +36,7 @@
 #include "lauxlib.h"
 
 #include <fcntl.h>
-#if defined(_GNU_SOURCE)
+#if defined(__linux__) && defined(_GNU_SOURCE)
 #include <linux/falloc.h>
 #endif
 
@@ -670,7 +670,7 @@
 	offset = luaL_checkinteger(L, 2);
 	len = luaL_checkinteger(L, 3);
 
-#if defined(_GNU_SOURCE)
+#if defined(__linux__) && defined(_GNU_SOURCE)
 	if(fallocate(fileno(f), FALLOC_FL_KEEP_SIZE, offset, len) == 0)
 	{
 		lua_pushboolean(L, 1);