about summary refs log tree commit diff
path: root/hurd
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2001-04-19 22:08:27 +0000
committerRoland McGrath <roland@gnu.org>2001-04-19 22:08:27 +0000
commit79c236ac12988ebe30c499c7775157a4a55d54b6 (patch)
tree3d4fbfec810e845643e6c4305d8d3a4f74d3227b /hurd
parent6610a14064b12ab2f05abb4a7dd79b3f08fe7bb9 (diff)
downloadglibc-79c236ac12988ebe30c499c7775157a4a55d54b6.tar.gz
glibc-79c236ac12988ebe30c499c7775157a4a55d54b6.tar.xz
glibc-79c236ac12988ebe30c499c7775157a4a55d54b6.zip
2001-04-19 Roland McGrath <roland@frob.com>
	* hurd/hurdsig.c (write_corefile): Check RLIMIT_CORE limit and do
	nothing if it's zero.
Diffstat (limited to 'hurd')
-rw-r--r--hurd/hurdsig.c14
1 files 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 <hurd/fd.h>
 #include <hurd/crash.h>
+#include <hurd/resource.h>
 #include <hurd/paths.h>
 #include <setjmp.h>
 #include <fcntl.h>
@@ -136,7 +138,6 @@ _hurd_thread_sigstate (thread_t thread)
 #include <assert.h>
 #include <unistd.h>
 
-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