Browse code

--debug improvement

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@347 77e5149b-7576-45b1-b177-96237e5ba77b

Tomasz Kojm authored on 2004/02/27 18:45:46
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Fri Feb 27 10:47:20 CET 2004 (tk)
2
+---------------------------------
3
+  * clamd: --debug: disable limit for a core size under Linux
4
+
1 5
 Fri Feb 27 09:30:20 GMT 2004 (njh)
2 6
 ----------------------------------
3 7
   * clamav-milter: Only use TCPwrappers when using TCP/IP to establish
... ...
@@ -37,6 +37,10 @@
37 37
 #include <syslog.h>
38 38
 #endif
39 39
 
40
+#ifdef C_LINUX
41
+#include <sys/resource.h>
42
+#endif
43
+
40 44
 #include "options.h"
41 45
 #include "cfgfile.h"
42 46
 #include "others.h"
... ...
@@ -72,10 +76,20 @@ void clamd(struct optstruct *opt)
72 72
     	help();
73 73
     }
74 74
 
75
-    if(optl(opt, "debug"))
75
+    if(optl(opt, "debug")) {
76
+#if defined(C_LINUX)
77
+	    /* njh@bandsman.co.uk: create a dump if needed */
78
+	    struct rlimit rlim;
79
+
80
+	rlim.rlim_cur = rlim.rlim_max = RLIM_INFINITY;
81
+	if(setrlimit(RLIMIT_CORE, &rlim) < 0)
82
+	    perror("setrlimit");
83
+#endif
76 84
 	debug_mode = 1;
77
-    else
85
+
86
+    } else {
78 87
 	debug_mode = 0;
88
+    }
79 89
 
80 90
     /* parse the config file */
81 91
     if(optc(opt, 'c'))