# HG changeset patch # User Matt Johnston # Date 1648102725 -28800 # Node ID 9382271da9ef734483b6c06625a9cf61f0130752 # Parent 4a6725ac957cbd81abb169a83f12292226567ec4 Only set soft core limit not hard limit Otherwise child shells can't enable coredumps if desired. Fixes #145 on github diff -r 4a6725ac957c -r 9382271da9ef dbutil.c --- a/dbutil.c Thu Mar 24 13:42:08 2022 +0800 +++ b/dbutil.c Thu Mar 24 14:18:45 2022 +0800 @@ -599,9 +599,14 @@ } 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 */