freshclam, clamd: handle EINTR during waitpid() (bb#2422)

remotes/push_mirror/multihash
Tomasz Kojm 15 years ago
parent 69e6d4bc54
commit 2e136dcd0d
  1. 4
      ChangeLog
  2. 2
      clamd/others.c
  3. 7
      freshclam/manager.c

@ -1,3 +1,7 @@
Thu Dec 16 14:15:33 CET 2010 (tk)
---------------------------------
* freshclam, clamd: handle EINTR during waitpid() (bb#2422)
Tue Dec 14 19:13:53 EET 2010 (edwin)
------------------------------------
* libclamav/chmunpack.c: avoid crash on fstat failure (bb #2429).

@ -146,7 +146,7 @@ void virusaction(const char *filename, const char *virname, const struct optstru
exit(execle("/bin/sh", "sh", "-c", buffer_cmd, NULL, env));
} else if(pid > 0) { /* parent */
pthread_mutex_unlock(&virusaction_lock);
waitpid(pid, NULL, 0);
while(waitpid(pid, NULL, 0) == -1 && errno = EINTR);
} else {
logg("!VirusEvent: fork failed.\n");
}

@ -1476,7 +1476,7 @@ static int test_database_wrap(const char *file, const char *newdb, int bytecode)
char lastline[256];
int pipefd[2];
pid_t pid;
int status = 0;
int status = 0, ret;
FILE *f;
if (pipe(pipefd) == -1) {
@ -1513,7 +1513,8 @@ static int test_database_wrap(const char *file, const char *newdb, int bytecode)
}
fclose(f);
if (waitpid(pid, &status, 0) == -1 && errno != ECHILD)
while ((ret = waitpid(pid, &status, 0)) == -1 && errno == EINTR);
if (ret == -1 && errno != ECHILD)
logg("^waitpid() failed: %s\n", strerror(errno));
cli_chomp(firstline);
cli_chomp(lastline);
@ -1523,7 +1524,7 @@ static int test_database_wrap(const char *file, const char *newdb, int bytecode)
lastline);
}
if (WIFEXITED(status)) {
int ret = WEXITSTATUS(status);
ret = WEXITSTATUS(status);
if (ret) {
logg("^Database load exited with status %d\n", ret);
return ret;

Loading…
Cancel
Save