From 79c236ac12988ebe30c499c7775157a4a55d54b6 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 19 Apr 2001 22:08:27 +0000 Subject: [PATCH] 2001-04-19 Roland McGrath * hurd/hurdsig.c (write_corefile): Check RLIMIT_CORE limit and do nothing if it's zero. --- hurd/hurdsig.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c index 3daef1142c..01a84274d5 100644 --- a/hurd/hurdsig.c +++ b/hurd/hurdsig.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1991,92,93,94,95,96,97,98,99,2000 Free Software Foundation, Inc. +/* Copyright (C) 1991,92,93,94,95,96,97,98,99,2000,01 + Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -125,6 +126,7 @@ _hurd_thread_sigstate (thread_t thread) #include #include +#include #include #include #include @@ -136,7 +138,6 @@ _hurd_thread_sigstate (thread_t thread) #include #include -int _hurd_core_limit; /* XXX */ /* Call the crash dump server to mummify us before we die. Returns nonzero if a core file was written. */ @@ -148,6 +149,15 @@ write_corefile (int signo, const struct hurd_signal_detail *detail) file_t file, coredir; const char *name; + /* Don't bother locking since we just read the one word. */ + rlim_t corelimit = _hurd_rlimits[RLIMIT_CORE].rlim_cur; + + if (corelimit == 0) + /* No core dumping, thank you very much. Note that this makes + `ulimit -c 0' prevent crash-suspension too, which is probably + what the user wanted. */ + return 0; + /* XXX RLIMIT_CORE: When we have a protocol to make the server return an error for RLIMIT_FSIZE, then tell the corefile fs server the RLIMIT_CORE