mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-17 12:18:08 +00:00
added read_timed
This commit is contained in:
@ -164,10 +164,9 @@ static void afl_fauxsrv_execv(afl_forkserver_t *fsrv, char **argv) {
|
||||
|
||||
void afl_fsrv_start(afl_forkserver_t *fsrv, char **argv) {
|
||||
|
||||
struct timeval timeout;
|
||||
int st_pipe[2], ctl_pipe[2];
|
||||
int status;
|
||||
s32 rlen;
|
||||
int st_pipe[2], ctl_pipe[2];
|
||||
int status;
|
||||
s32 rlen;
|
||||
|
||||
if (fsrv->use_fauxsrv) ACTF("Using Fauxserver:");
|
||||
|
||||
@ -318,24 +317,15 @@ void afl_fsrv_start(afl_forkserver_t *fsrv, char **argv) {
|
||||
rlen = 0;
|
||||
if (fsrv->exec_tmout) {
|
||||
|
||||
fd_set readfds;
|
||||
rlen = 4;
|
||||
u32 time = read_timed(fsrv->fsrv_st_fd, &status, rlen,
|
||||
fsrv->exec_tmout * FORK_WAIT_MULT);
|
||||
|
||||
FD_ZERO(&readfds);
|
||||
FD_SET(fsrv->fsrv_st_fd, &readfds);
|
||||
timeout.tv_sec = ((fsrv->exec_tmout * FORK_WAIT_MULT) / 1000);
|
||||
timeout.tv_usec = ((fsrv->exec_tmout * FORK_WAIT_MULT) % 1000) * 1000;
|
||||
|
||||
int sret = select(fsrv->fsrv_st_fd + 1, &readfds, NULL, NULL, &timeout);
|
||||
|
||||
if (sret == 0) {
|
||||
if (!time) {
|
||||
|
||||
fsrv->child_timed_out = 1;
|
||||
kill(fsrv->child_pid, SIGKILL);
|
||||
|
||||
} else {
|
||||
|
||||
rlen = read(fsrv->fsrv_st_fd, &status, 4);
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user