mirror of
https://github.com/monero-project/monero.git
synced 2025-08-13 18:35:33 -04:00
wallet: disable core dumps on startup in release mode
This commit is contained in:
parent
eed4dba880
commit
4307489147
4 changed files with 24 additions and 0 deletions
|
@ -37,6 +37,7 @@
|
|||
#ifdef __GLIBC__
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/resource.h>
|
||||
#include <ustat.h>
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
|
@ -682,6 +683,21 @@ std::string get_nix_version_display_string()
|
|||
static void setup_crash_dump() {}
|
||||
#endif
|
||||
|
||||
bool disable_core_dumps()
|
||||
{
|
||||
#ifdef __GLIBC__
|
||||
// disable core dumps in release mode
|
||||
struct rlimit rlimit;
|
||||
rlimit.rlim_cur = rlimit.rlim_max = 0;
|
||||
if (setrlimit(RLIMIT_CORE, &rlimit))
|
||||
{
|
||||
MWARNING("Failed to disable core dumps");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
bool on_startup()
|
||||
{
|
||||
mlog_configure("", true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue