]> git.mdlowis.com Git - proto/labwc.git/commitdiff
main: Increase FD limit
authorJoshua Ashton <joshua@froggi.es>
Sun, 17 Jul 2022 00:49:26 +0000 (00:49 +0000)
committerJoshua Ashton <joshua@froggi.es>
Sun, 17 Jul 2022 00:59:23 +0000 (00:59 +0000)
This defaults to 1024, which is tiny, but is a requirement
for processes using the deprecated `select` function.

We must reset this back whenever we fork to start a new process,
as this is inherited, and breaks applications using `select` otherwise.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
src/common/spawn.c
src/main.c

index d8d0abd4df7e32580a7f4e6a1622eb9a83d06979..349f65fcec9482bb7aa6b6d5ef4b35f5ee3229d0 100644 (file)
@@ -10,6 +10,7 @@
 #include <unistd.h>
 #include <wlr/util/log.h>
 #include "common/spawn.h"
+#include "common/fd_util.h"
 
 void
 spawn_async_no_shell(char const *command)
@@ -39,6 +40,8 @@ spawn_async_no_shell(char const *command)
                wlr_log(WLR_ERROR, "unable to fork()");
                goto out;
        case 0:
+               restore_nofile_limit();
+
                setsid();
                sigset_t set;
                sigemptyset(&set);
index 1e2dc1eef95a7a1a2daa4028dbcb7b202190dd5b..0cb521b5a9e9ef0fe63ee5e17e4c8b732181de3e 100644 (file)
@@ -9,6 +9,7 @@
 #include "theme.h"
 #include "xbm/xbm.h"
 #include "menu/menu.h"
+#include "common/fd_util.h"
 
 struct rcxml rc = { 0 };
 
@@ -85,6 +86,8 @@ main(int argc, char *argv[])
                exit(EXIT_FAILURE);
        }
 
+       increase_nofile_limit();
+
        struct server server = { 0 };
        server_init(&server);
        server_start(&server);