aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2026-09-06 05:19:15 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2026-09-06 05:19:15 +0000
commit4344d34242c27734a2940ab5f995c7b9fb4803e2 (patch)
tree310eae3294266ee4d26f372291fc5b2ca3e145f2
parentdb2afe7d532652400b28af7b7f3367ef8ad3d7d5 (diff)
downloads6-4344d34242c27734a2940ab5f995c7b9fb4803e2.tar.gz
s6-softlimit -h: actually lower the soft limit if needed
-rw-r--r--src/daemontools-extras/s6-softlimit.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/daemontools-extras/s6-softlimit.c b/src/daemontools-extras/s6-softlimit.c
index beb7325..11f38eb 100644
--- a/src/daemontools-extras/s6-softlimit.c
+++ b/src/daemontools-extras/s6-softlimit.c
@@ -25,7 +25,11 @@ static void doit (int res, char const *arg)
{
uint64_t n ;
if (!uint640_scan(arg, &n)) strerr_dieusage(100, USAGE) ;
- if (what & 2) r.rlim_max = n ;
+ if (what & 2)
+ {
+ r.rlim_max = n ;
+ if (!(what & 1) && r.rlim_cur > n) r.rlim_cur = n ;
+ }
if (what & 1)
{
if (n > r.rlim_max) n = r.rlim_max ;