util.pposix: Fix building on non-Linux with glibc
authorKim Alvefur <zash@zash.se>
Mon, 2 Sep 2013 16:19:38 +0000 (18:19 +0200)
committerKim Alvefur <zash@zash.se>
Mon, 2 Sep 2013 16:19:38 +0000 (18:19 +0200)
util-src/pposix.c

index e2cd142ef99c4bff536b1ea4c6856ef1a1af8946..7f64038beb3bd07bd353396ee47de4502e1db0b8 100644 (file)
@@ -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 @@ int lc_fallocate(lua_State* L)
        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);