From 6b7255fdeb51682abc1dc044b43e7e3409e228e3 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Fri, 26 Feb 2021 09:11:56 +0100 Subject: [PATCH] Fix regression introduced in 7ef25ab, global rlimits not initialized Services that are instantiated by plugins, and thus don't have a .conf file, tried to use uninitialized rlimits. This caused the kernel to immediately kill those services for violating their own rlimits. Signed-off-by: Joachim Wiberg --- src/conf.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/conf.c b/src/conf.c index ae7def33..ffc674df 100644 --- a/src/conf.c +++ b/src/conf.c @@ -902,6 +902,14 @@ int conf_init(uev_ctx_t *ctx) /* default hostname */ hostname = strdup(DEFHOST); + /* + * Get current global limits, which may be overridden from both + * finit.conf, for Finit and its services like getty+watchdogd, + * and *.conf in finit.d/, for each service(s) listed there. + */ + for (int i = 0; i < RLIMIT_NLIMITS; i++) + getrlimit(i, &global_rlimit[i]); + /* prepare /etc watcher */ fd = iwatch_init(&iw_conf); if (fd < 0)