--- main.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/main.c b/main.c index 0542fab..0c43584 100644 --- a/main.c +++ b/main.c _AT_@ -285,16 +285,21 @@ main(int argc, char *argv[]) } /* raise the process limit */ - rlim.rlim_cur = rlim.rlim_max = maxnprocs; - if (setrlimit(RLIMIT_NPROC, &rlim) < 0) { - die("setrlimit RLIMIT_NPROC:"); - } - - /* validate user and group */ - errno = 0; - if (!user || !(pwd = getpwnam(user))) { - die("getpwnam '%s': %s", user ? user : "null", - errno ? strerror(errno) : "Entry not found"); + if (getrlimit(RLIMIT_NPROC, &rlim) < 0) { + die("getrlimit RLIMIT_NPROC:"); + } + + rlim.rlim_cur = MAX(rlim.rlim_cur, maxnprocs); + rlim.rlim_max = MAX(rlim.rlim_max, maxnprocs); + if (setrlimit(RLIMIT_NPROC, &rlim) < 0) { + die("setrlimit RLIMIT_NPROC:"); + } + + /* validate user and group */ + errno = 0; + if (!user || !(pwd = getpwnam(user))) { + die("getpwnam '%s': %s", user ? user : "null", + errno ? strerror(errno) : "Entry not found"); } errno = 0; if (!group || !(grp = getgrnam(group))) { -- 2.26.2Received on Mon Aug 17 2020 - 22:55:19 CEST
This archive was generated by hypermail 2.3.0 : Mon Aug 17 2020 - 23:48:32 CEST