comparison dbutil.c @ 1903:9382271da9ef

Only set soft core limit not hard limit Otherwise child shells can't enable coredumps if desired. Fixes #145 on github
author Matt Johnston <matt@ucc.asn.au>
date Thu, 24 Mar 2022 14:18:45 +0800
parents 3f87f7ff1092
children 667937351c31
comparison
equal deleted inserted replaced
1902:4a6725ac957c 1903:9382271da9ef
597 } 597 }
598 TRACE(("leave setnonblocking")) 598 TRACE(("leave setnonblocking"))
599 } 599 }
600 600
601 void disallow_core() { 601 void disallow_core() {
602 struct rlimit lim; 602 struct rlimit lim = {0};
603 lim.rlim_cur = lim.rlim_max = 0; 603 if (getrlimit(RLIMIT_CORE, &lim) < 0) {
604 setrlimit(RLIMIT_CORE, &lim); 604 TRACE(("getrlimit(RLIMIT_CORE) failed"));
605 }
606 lim.rlim_cur = 0;
607 if (setrlimit(RLIMIT_CORE, &lim) < 0) {
608 TRACE(("setrlimit(RLIMIT_CORE) failed"));
609 }
605 } 610 }
606 611
607 /* Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE, with the result in *val */ 612 /* Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE, with the result in *val */
608 int m_str_to_uint(const char* str, unsigned int *val) { 613 int m_str_to_uint(const char* str, unsigned int *val) {
609 unsigned long l; 614 unsigned long l;