diff options
author | Matt Johnston <matt@ucc.asn.au> | 2022-03-24 14:18:45 +0800 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2022-03-24 14:18:45 +0800 |
commit | 08efce06f113ca3f410e2c2a5f5c4163328d4010 (patch) | |
tree | e0c985506bf433cb909ac886e274d5586ecd9d41 | |
parent | 5af2b90518cc0a7014467e29da6f3f9efbc7dfe1 (diff) | |
download | dropbear-08efce06f113ca3f410e2c2a5f5c4163328d4010.tar.gz |
Only set soft core limit not hard limit
Otherwise child shells can't enable coredumps if desired.
Fixes #145 on github
-rw-r--r-- | dbutil.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -599,9 +599,14 @@ void setnonblocking(int fd) { } void disallow_core() { - struct rlimit lim; - lim.rlim_cur = lim.rlim_max = 0; - setrlimit(RLIMIT_CORE, &lim); + struct rlimit lim = {0}; + if (getrlimit(RLIMIT_CORE, &lim) < 0) { + TRACE(("getrlimit(RLIMIT_CORE) failed")); + } + lim.rlim_cur = 0; + if (setrlimit(RLIMIT_CORE, &lim) < 0) { + TRACE(("setrlimit(RLIMIT_CORE) failed")); + } } /* Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE, with the result in *val */ |