From beb69a4ab0828ffee82eec66e495b1fb02efe661 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 30 Aug 2013 16:14:31 +0200 Subject: util.net: Fix s2sout on Windows (return 0.0.0.0 and :: instead of an empty list) --- util-src/net.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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; } -- cgit v1.2.3 From e7c0815019ee81eeff6bd14f837b9d067f57275d Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 30 Aug 2013 18:51:55 +0200 Subject: configmanager: Fix checking of absolute paths on Windows --- core/configmanager.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/configmanager.lua b/core/configmanager.lua index 9720f48a..d73bafa4 100644 --- a/core/configmanager.lua +++ b/core/configmanager.lua @@ -77,7 +77,7 @@ do local is_relative; if path_sep == "/" and path:sub(1,1) ~= "/" then is_relative = true; - elseif path_sep == "\\" and (path:sub(1,1) ~= "/" and (path:sub(2,3) ~= ":\\" or path:sub(2,3) ~= ":/")) then + elseif path_sep == "\\" and (path:sub(1,1) ~= "/" and (path:sub(2,3) ~= ":\\" and path:sub(2,3) ~= ":/")) then is_relative = true; end if is_relative then -- cgit v1.2.3 From 25d7ead6bb062330390b00da01bab4eb207a9297 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 2 Sep 2013 18:19:38 +0200 Subject: util.pposix: Fix building on non-Linux with glibc --- util-src/pposix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util-src/pposix.c b/util-src/pposix.c index e2cd142e..7f64038b 100644 --- a/util-src/pposix.c +++ b/util-src/pposix.c @@ -36,7 +36,7 @@ #include "lauxlib.h" #include -#if defined(_GNU_SOURCE) +#if defined(__linux__) && defined(_GNU_SOURCE) #include #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); -- cgit v1.2.3 From cb7584022716f4407b4460754645e6af587e4730 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Mon, 2 Sep 2013 20:52:19 +0100 Subject: util.set: Fix :include() and :exclude() methods to iterate the input set correctly --- util/set.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/set.lua b/util/set.lua index 7f45526e..b9e9ef21 100644 --- a/util/set.lua +++ b/util/set.lua @@ -91,13 +91,13 @@ function new(list) end function set:include(otherset) - for item in pairs(otherset) do + for item in otherset do items[item] = true; end end function set:exclude(otherset) - for item in pairs(otherset) do + for item in otherset do items[item] = nil; end end -- cgit v1.2.3