Browse code

handle waitpid failure with EINTR

aCaB authored on 2010/12/16 23:32:29
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Thu Dec 16 15:31:38 CET 2010 (acab)
2
+---------------------------------
3
+ * clamav-milter: handle EINTR during waitpid()
4
+
1 5
 Thu Dec 16 14:15:33 CET 2010 (tk)
2 6
 ---------------------------------
3 7
  * freshclam, clamd: handle EINTR during waitpid() (bb#2422)
... ...
@@ -382,8 +382,10 @@ sfsistat clamfi_eom(SMFICTX *ctx) {
382 382
 				args[8] = NULL;
383 383
 				exit(execvp(viraction, args));
384 384
 			    } else if(pid > 0) {
385
+				int wret;
385 386
 				pthread_mutex_unlock(&virusaction_lock);
386
-				if(waitpid(pid, &ret, 0)<0)
387
+				while((wret = waitpid(pid, &ret, 0)) == -1 && errno == EINTR);
388
+				if(wret<0)
387 389
 				    logg("!VirusEvent: waitpid() failed: %s\n", cli_strerror(errno, er, sizeof(er)));
388 390
 				else {
389 391
 				    if(WIFEXITED(ret))