aboutsummaryrefslogtreecommitdiffstats
path: root/util-src
diff options
context:
space:
mode:
Diffstat (limited to 'util-src')
-rw-r--r--util-src/crand.c2
-rw-r--r--util-src/pposix.c13
2 files changed, 14 insertions, 1 deletions
diff --git a/util-src/crand.c b/util-src/crand.c
index 735135fb..fbdec8f8 100644
--- a/util-src/crand.c
+++ b/util-src/crand.c
@@ -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
diff --git a/util-src/pposix.c b/util-src/pposix.c
index 1b69852d..b48465d3 100644
--- a/util-src/pposix.c
+++ b/util-src/pposix.c
@@ -49,6 +49,19 @@
#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) {