Browse code

Cleanup signal handling

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

Trog authored on 2004/03/01 22:15:55
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Mon Mar  1 13:22:30 GMT 2004 (trog)
2
+-----------------------------------
3
+  * clamd: Cleanup signal handling
4
+
1 5
 Mon Mar  1 13:08:04 GMT 2004 (trog)
2 6
 -----------------------------------
3 7
   * clamd: Cleanup local socket and clamd.run on exit
... ...
@@ -29,6 +29,7 @@
29 29
 #include <time.h>
30 30
 #include <sys/types.h>
31 31
 #include <sys/socket.h>
32
+#include <unistd.h>
32 33
 
33 34
 #include "server.h"
34 35
 #include "thrmgr.h"
... ...
@@ -89,27 +90,22 @@ void scanner_thread(void *arg)
89 89
 
90 90
 void sighandler_th(int sig)
91 91
 {
92
-	time_t currtime;
92
+	//time_t currtime;
93 93
 
94 94
     switch(sig) {
95 95
 	case SIGINT:
96 96
 	case SIGTERM:
97 97
 	    progexit = 1;
98
-	    logg("*Signal %d caught -> exiting.\n", sig);
99
-	    time(&currtime);
100
-	    logg("--- Stopped at %s", ctime(&currtime));
101
-	    exit(0);
102
-	    break; /* not reached */
98
+	    break;
103 99
 
104
-	    case SIGSEGV:
105
-		logg("Segmentation fault :-( Bye..\n");
106
-		exit(11); /* probably not reached at all */
107
-		break; /* not reached */
100
+	case SIGSEGV:
101
+	    logg("Segmentation fault :-( Bye..\n");
102
+	    _exit(11); /* probably not reached at all */
103
+	    break; /* not reached */
108 104
 
109
-	    case SIGHUP:
110
-		sighup = 1;
111
-		/*logg("SIGHUP caught: log file re-opened.\n"); */
112
-		break;
105
+	case SIGHUP:
106
+	    sighup = 1;
107
+	    break;
113 108
     }
114 109
 }
115 110
 
... ...
@@ -483,5 +479,8 @@ int acceptloop_th(int socketd, struct cl_node *root, const struct cfgstruct *cop
483 483
     }
484 484
 
485 485
     logg("Exiting (clean)\n");
486
+    time(&current_time);
487
+    logg("--- Stopped at %s", ctime(&current_time));
488
+
486 489
     return 0;
487 490
 }