summaryrefslogtreecommitdiff
path: root/bin/csh
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2021-07-02 15:34:28 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2021-07-02 15:34:28 +0000
commitdecce8b3e91b65817fd87fc2eab6fe789481201a (patch)
treeb2581b2ea713d88e2d8e98707a6c9d722b86043a /bin/csh
parent4ce8bdc78901cb2369b086b27ec7b056960c2016 (diff)
Before calling setrlimit(), pull cur up to max.
ok millert
Diffstat (limited to 'bin/csh')
-rw-r--r--bin/csh/func.c5
1 files changed, 4 insertions, 1 deletions
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",