Browse code

freshclam: fix pidfile removal (bb#3499)

Tomasz Kojm authored on 2011/09/15 21:44:43
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Thu Sep 15 14:44:11 CEST 2011 (tk)
2
+----------------------------------
3
+ * freshclam: fix pidfile removal (bb#3499)
4
+
1 5
 Mon Sep 12 16:29:22 CEST 2011 (tk)
2 6
 ----------------------------------
3 7
  * freshclam: add new option PrivateMirror (bb#3058)
... ...
@@ -65,6 +65,7 @@ extern int active_children;
65 65
 static short foreground = 1;
66 66
 char updtmpdir[512], dbdir[512];
67 67
 int sigchld_wait = 1;
68
+const char *pidfile = NULL;
68 69
 
69 70
 static void sighandler(int sig) {
70 71
 
... ...
@@ -103,7 +104,9 @@ static void sighandler(int sig) {
103 103
 	default:
104 104
 	    if(*updtmpdir)
105 105
 		cli_rmdirs(updtmpdir);
106
-	    logg("Update process interrupted\n");
106
+	    if(pidfile)
107
+		unlink(pidfile);
108
+	    logg("Update process terminated\n");
107 109
 	    exit(2);
108 110
     }
109 111
 
... ...
@@ -224,7 +227,7 @@ static void msg_callback(enum cl_msg severity, const char *fullmsg, const char *
224 224
 int main(int argc, char **argv)
225 225
 {
226 226
 	int ret = 52, retcl;
227
-	const char *cfgfile, *arg = NULL, *pidfile = NULL;
227
+	const char *cfgfile, *arg = NULL;
228 228
 	char *pt;
229 229
 	struct optstruct *opts;
230 230
 	const struct optstruct *opt;