Merge 0.9->trunk
authorMatthew Wild <mwild1@gmail.com>
Tue, 03 Sep 2013 00:20:28 +0100
changeset 5814 5cf1c08805fb
parent 5809 be997c6a69be (current diff)
parent 5813 c888f548876b (diff)
child 5817 6e087f3b8f3b
Merge 0.9->trunk
core/configmanager.lua
util-src/pposix.c
util/set.lua
--- a/core/configmanager.lua	Mon Sep 02 15:22:41 2013 +0100
+++ b/core/configmanager.lua	Tue Sep 03 00:20:28 2013 +0100
@@ -77,7 +77,7 @@
 			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
--- a/util-src/net.c	Mon Sep 02 15:22:41 2013 +0100
+++ b/util-src/net.c	Tue Sep 03 00:20:28 2013 +0100
@@ -42,8 +42,8 @@
 	const long ip4_linklocal = htonl(0xa9fe0000); /* 169.254.0.0 */
 	const long ip4_mask      = htonl(0xffff0000);
 	struct ifaddrs *addr = NULL, *a;
+#endif
 	int n = 1;
-#endif
 	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 @@
 	}
 
 	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;
 }
--- a/util-src/pposix.c	Mon Sep 02 15:22:41 2013 +0100
+++ b/util-src/pposix.c	Tue Sep 03 00:20:28 2013 +0100
@@ -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 @@
 	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);
--- a/util/set.lua	Mon Sep 02 15:22:41 2013 +0100
+++ b/util/set.lua	Tue Sep 03 00:20:28 2013 +0100
@@ -91,13 +91,13 @@
 	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