diff options
author | Matthew Wild <mwild1@gmail.com> | 2013-09-03 00:20:28 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2013-09-03 00:20:28 +0100 |
commit | c6bf0953e395f36b133e0c2e8cc2ef25e943df7f (patch) | |
tree | 830cfa780955b317d2dcfed69ec03eef9580d00b /util-src | |
parent | 2fa9d5e3837fd16af5de15761a10319008814301 (diff) | |
parent | beb2881c21aa0111cb9c57bf38f162af8222045b (diff) | |
download | prosody-c6bf0953e395f36b133e0c2e8cc2ef25e943df7f.tar.gz prosody-c6bf0953e395f36b133e0c2e8cc2ef25e943df7f.zip |
Merge 0.9->trunk
Diffstat (limited to 'util-src')
-rw-r--r-- | util-src/net.c | 11 | ||||
-rw-r--r-- | util-src/pposix.c | 4 |
2 files changed, 12 insertions, 3 deletions
diff --git a/util-src/net.c b/util-src/net.c index 09ba92b8..e307c628 100644 --- a/util-src/net.c +++ b/util-src/net.c @@ -42,8 +42,8 @@ static int lc_local_addresses(lua_State *L) const long ip4_linklocal = htonl(0xa9fe0000); /* 169.254.0.0 */ const long ip4_mask = htonl(0xffff0000); struct ifaddrs *addr = NULL, *a; - int n = 1; #endif + int n = 1; int type = luaL_checkoption(L, 1, "both", type_strings); const char link_local = lua_toboolean(L, 2); /* defaults to 0 (false) */ const char ipv4 = (type == 0 || type == 1); @@ -92,6 +92,15 @@ static int lc_local_addresses(lua_State *L) } freeifaddrs(addr); +#else + if (ipv4) { + lua_pushstring(L, "0.0.0.0"); + lua_rawseti(L, -2, n++); + } + if (ipv6) { + lua_pushstring(L, "::"); + lua_rawseti(L, -2, n++); + } #endif return 1; } diff --git a/util-src/pposix.c b/util-src/pposix.c index 2e1de971..8ad167b7 100644 --- a/util-src/pposix.c +++ b/util-src/pposix.c @@ -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 @@ -680,7 +680,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); |