summaryrefslogtreecommitdiffstats
path: root/src/tmpfiles
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2019-01-18 16:34:52 +0100
committerLennart Poettering <lennart@poettering.net>2019-02-15 17:16:54 +0100
commite5358401b5df8d395e99815b7a69b8424887472c (patch)
treecee2cc829abb71a1d6a12aacb26d5898081b367a /src/tmpfiles
parentman: document the new BSD file lock logic in tmpfiles (diff)
downloadsystemd-e5358401b5df8d395e99815b7a69b8424887472c.tar.xz
systemd-e5358401b5df8d395e99815b7a69b8424887472c.zip
tmpfiles: let's bump RLIMIT_NOFILE for tmpfiles
We potentially might descent into quite deep directory trees. Let's hence make sure we can allocate a lot of fds. (This reflects the fact that glibc nftw() and friends have some logic in place to reduce fd usage while descending into directory trees. Doing so is a bit nasty I think, and given that fds are basically free now, if we ask for them, lte's just protect ourselves and make use of that) (No, I am not aware of a real-world case where this was necessary, but let's better be safe than sorry)
Diffstat (limited to 'src/tmpfiles')
-rw-r--r--src/tmpfiles/tmpfiles.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index 04cd0bfa33..6296a8acdf 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -49,6 +49,7 @@
#include "path-lookup.h"
#include "path-util.h"
#include "pretty-print.h"
+#include "rlimit-util.h"
#include "rm-rf.h"
#include "selinux-util.h"
#include "set.h"
@@ -3175,6 +3176,9 @@ static int run(int argc, char *argv[]) {
log_setup_service();
+ /* Descending down file system trees might take a lot of fds */
+ (void) rlimit_nofile_bump(HIGH_RLIMIT_NOFILE);
+
if (arg_user) {
r = user_config_paths(&config_dirs);
if (r < 0)