Try to disable core dumps for this process. Return TRUE if successful, FALSE otherwise. */
| 484 | /* Try to disable core dumps for this process. |
| 485 | Return TRUE if successful, FALSE otherwise. */ |
| 486 | static bool |
| 487 | disable_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 | |
| 507 | int |
| 508 | main (int argc, char **argv) |