From: deraadt Date: Fri, 2 Jul 2021 15:34:27 +0000 (+0000) Subject: Before calling setrlimit(), pull cur up to max. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=2775762a0ce06a40722366f292bf0f8fa53b09b9;p=openbsd Before calling setrlimit(), pull cur up to max. ok millert --- diff --git a/bin/csh/func.c b/bin/csh/func.c index fa6530303fc..9a8414360cc 100644 --- a/bin/csh/func.c +++ b/bin/csh/func.c @@ -1,4 +1,4 @@ -/* $OpenBSD: func.c,v 1.39 2019/06/28 13:34:58 deraadt Exp $ */ +/* $OpenBSD: func.c,v 1.40 2021/07/02 15:34:27 deraadt Exp $ */ /* $NetBSD: func.c,v 1.11 1996/02/09 02:28:29 christos Exp $ */ /*- @@ -1248,6 +1248,9 @@ setlim(struct limits *lp, Char hard, rlim_t limit) else rlim.rlim_cur = limit; + if (rlim.rlim_max < rlim.rlim_cur) + rlim.rlim_max = rlim.rlim_cur; + if (setrlimit(lp->limconst, &rlim) == -1) { (void) fprintf(csherr, "%s: %s: Can't %s%s limit\n", bname, lp->limname, limit == RLIM_INFINITY ? "remove" : "set",