Browse code

mask sigpipe

git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4708 77e5149b-7576-45b1-b177-96237e5ba77b

aCaB authored on 2009/02/09 01:46:26
Showing 2 changed files
... ...
@@ -55,6 +55,7 @@ int main(int argc, char **argv)
55 55
 	time_t starttime;
56 56
         struct optstruct *opts;
57 57
         const struct optstruct *opt;
58
+	struct sigaction sigact;
58 59
 
59 60
 
60 61
     if((opts = optparse(NULL, argc, argv, 1, OPT_CLAMDSCAN, OPT_CLAMSCAN, NULL)) == NULL) {
... ...
@@ -108,6 +109,11 @@ int main(int argc, char **argv)
108 108
     }
109 109
 
110 110
     actsetup(opts);
111
+    memset(&sigact, 0, sizeof(struct sigaction));
112
+    sigact.sa_handler = SIG_IGN;
113
+    sigemptyset(&sigact.sa_mask);
114
+    sigaddset(&sigact.sa_mask, SIGPIPE);
115
+    sigaction(SIGPIPE, &sigact, NULL);
111 116
 
112 117
     time(&starttime);
113 118
     /* ctime() does \n, but I need it once more */
... ...
@@ -549,7 +549,7 @@ int parallel_client_scan(const char *file, int scantype, int *infected, int *err
549 549
     close(cdata.sockd);
550 550
 
551 551
     if(cdata.ids) {
552
-	logg("!Clamd closed connection before scannign all files. ERROR\n");
552
+	logg("!Clamd closed connection before scanning all files.\n");
553 553
     } else {
554 554
 	if(!printinfected && !cdata.infected && (!cdata.errors || cdata.spam))
555 555
 	    logg("~%s: OK\n", file);