Merge 0.10->trunk
authorKim Alvefur <zash@zash.se>
Wed, 25 May 2016 19:35:09 +0000 (21:35 +0200)
committerKim Alvefur <zash@zash.se>
Wed, 25 May 2016 19:35:09 +0000 (21:35 +0200)
util-src/crand.c
util-src/pposix.c

index 735135fb81a416de72ad849cf433bc5823c6aac6..fbdec8f8a4681da1d4a3536b4aae5fa6ed96ecd9 100644 (file)
@@ -106,7 +106,7 @@ int Lrandom(lua_State *L) {
 
 #endif
 
-       lua_pushlstring(L, buf, ret);
+       lua_pushlstring(L, (const char *)buf, ret);
 #ifndef BUFLEN
        free(buf);
 #endif
index 1b69852d2a703cacf2619adeffe821ad5ddb3b94..b48465d3a75461bd6a9ee216fbace132d81e647c 100644 (file)
 #define WITH_MALLINFO
 #endif
 
+#if defined(RFPROC) && defined(EV_SET)
+/*
+ * On *BSD, calling fork() is equivalent to rfork(RFPROC | RFFDG).
+ *
+ * RFFDG being set means that the file descriptor table is copied,
+ * otherwise it's shared. We want the later, otherwise libevent gets
+ * messed up.
+ *
+ * See issue #412
+ */
+#define fork() rfork(RFPROC)
+#endif
+
 /* Daemonization support */
 
 static int lc_daemonize(lua_State* L) {