Browse code

clamd/clamd.c: ignore SIGHUP and SIGUSR2 during initial setup (bb#1671)

Tomasz Kojm authored on 2009/08/06 01:34:21
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Wed Aug  5 18:33:11 CEST 2009 (tk)
2
+----------------------------------
3
+ * clamd/clamd.c: ignore SIGHUP and SIGUSR2 during initial setup (bb#1671)
4
+
1 5
 Wed Aug  5 16:27:06 CEST 2009 (tk)
2 6
 ----------------------------------
3 7
  * clamd, clamscan: add support for CrossFilesystems/--cross-fs (bb#1607)
... ...
@@ -42,6 +42,7 @@
42 42
 #else
43 43
 #include <pwd.h>
44 44
 #include <grp.h>
45
+#include <signal.h>
45 46
 #endif
46 47
 
47 48
 #if defined(USE_SYSLOG) && !defined(C_AIX)
... ...
@@ -98,6 +99,7 @@ int main(int argc, char **argv)
98 98
 	const struct optstruct *opt;
99 99
 #ifndef	C_WINDOWS
100 100
         struct passwd *user = NULL;
101
+	struct sigaction sa;
101 102
 #endif
102 103
 	time_t currtime;
103 104
 	const char *dbdir, *cfgfile;
... ...
@@ -115,6 +117,11 @@ int main(int argc, char **argv)
115 115
 	mprintf("!Can't start the win32 pthreads layer\n");
116 116
         return 1;
117 117
     }
118
+#else
119
+    memset(&sa, 0, sizeof(sa));
120
+    sa.sa_handler = SIG_IGN;
121
+    sigaction(SIGHUP, &sa, NULL);
122
+    sigaction(SIGUSR2, &sa, NULL);
118 123
 #endif
119 124
 
120 125
     if((opts = optparse(NULL, argc, argv, 1, OPT_CLAMD, 0, NULL)) == NULL) {