net.server_select: Limit global number of sockets passed to select.
[prosody.git] / util-src / pposix.c
index bda13ec020616dcb7b10231ab71d48fa6a9d3671..05303d99ae574a2e1ab990f64d06d206e19fd11a 100644 (file)
@@ -89,6 +89,10 @@ static int lc_daemonize(lua_State *L)
        close(0);
        close(1);
        close(2);
+       /* Make sure accidental use of FDs 0, 1, 2 don't cause weirdness */
+       open("/dev/null", O_RDONLY);
+       open("/dev/null", O_WRONLY);
+       open("/dev/null", O_WRONLY);
 
        /* Final fork, use it wisely */
        if(fork())
@@ -674,6 +678,10 @@ int lc_fallocate(lua_State* L)
                lua_pushstring(L, strerror(errno));
                return 2;
        }
+#else
+#warning Only using posix_fallocate() fallback.
+#warning Linux fallocate() is strongly recommended if available: recompile with -D_GNU_SOURCE
+#warning Note that posix_fallocate() will still be used on filesystems that dont support fallocate()
 #endif
 
        if(posix_fallocate(fileno(f), offset, len) == 0)