MCPcopy Create free account
hub / github.com/coreutils/coreutils / disable_core_dumps

Function disable_core_dumps

src/timeout.c:486–505  ·  view source on GitHub ↗

Try to disable core dumps for this process. Return TRUE if successful, FALSE otherwise. */

Source from the content-addressed store, hash-verified

484/* Try to disable core dumps for this process.
485 Return TRUE if successful, FALSE otherwise. */
486static bool
487disable_core_dumps (void)
488{
489#if HAVE_PRCTL && defined PR_SET_DUMPABLE
490 if (prctl (PR_SET_DUMPABLE, 0) == 0)
491 return true;
492
493#elif HAVE_SETRLIMIT && defined RLIMIT_CORE
494 /* Note this doesn't disable processing by a filter in
495 /proc/sys/kernel/core_pattern on Linux. */
496 if (setrlimit (RLIMIT_CORE, &(struct rlimit) {0}) == 0)
497 return true;
498
499#else
500 return false;
501#endif
502
503 error (0, errno, _("warning: disabling core dumps failed"));
504 return false;
505}
506
507int
508main (int argc, char **argv)

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected