X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=util-src%2Fpposix.c;h=b48465d3a75461bd6a9ee216fbace132d81e647c;hb=f6d29ba45f7d0ea7338666025319e1b2dd3f25f3;hp=1b69852d2a703cacf2619adeffe821ad5ddb3b94;hpb=884ef2b33ffa8bc699fb7e6169a5b02b5e8f91f0;p=prosody.git 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) {