aboutsummaryrefslogtreecommitdiffstats
path: root/g10/misc.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>1998-07-14 17:10:28 +0000
committerWerner Koch <[email protected]>1998-07-14 17:10:28 +0000
commit0a76a4465be37c29de4459096e89f9f8b9964cf7 (patch)
tree5fb00ca21525cb2d9ffbfd81312596a80925403b /g10/misc.c
parentfixed types, added new translations. (diff)
downloadgnupg-0a76a4465be37c29de4459096e89f9f8b9964cf7.tar.gz
gnupg-0a76a4465be37c29de4459096e89f9f8b9964cf7.zip
sync
Diffstat (limited to 'g10/misc.c')
-rw-r--r--g10/misc.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/g10/misc.c b/g10/misc.c
index 470307363..ec7c40a1a 100644
--- a/g10/misc.c
+++ b/g10/misc.c
@@ -22,10 +22,15 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <errno.h>
#if defined(__linux__) && defined(__alpha__)
#include <asm/sysinfo.h>
#include <asm/unistd.h>
#endif
+#ifdef HAVE_SETRLIMIT
+ #include <sys/time.h>
+ #include <sys/resource.h>
+#endif
#include "util.h"
#include "main.h"
#include "options.h"
@@ -70,6 +75,23 @@ trap_unaligned(void)
#endif
+void
+disable_core_dumps()
+{
+ #ifdef HAVE_SETRLIMIT
+ struct rlimit limit;
+
+ limit.rlim_cur = 0;
+ limit.rlim_max = 0;
+ if( setrlimit( RLIMIT_CORE, &limit ) )
+ log_fatal("can't disable core dumps: %s\n", strerror(errno) );
+ #else
+ log_info("WARNING: Program may create a core file!\n");
+ #endif
+}
+
+
+
u16
checksum_u16( unsigned n )
{