Browse Source

Do not filter twice

If Linux Socket Filtering is available, don't do in userspace
what we already asked the kernel to do for us.
develop
Damien Goutte-Gattat 9 years ago
parent
commit
0cbd3d7b89
  1. 6
      src/wait4pid.c

6
src/wait4pid.c

@ -215,6 +215,11 @@ wait4all(pid_t *pids, size_t len)
if ( payload->evt.what != PROC_EVENT_EXIT )
continue;
#ifdef HAVE_LINUX_FILTER_H
nproc -= 1;
if ( payload->evt.event_data.exit.process_pid == pids[len-1] )
ec = WEXITSTATUS(payload->evt.event_data.exit.exit_code);
#else
for ( i = 0; i < len; i++ ) {
if ( pids[i] != -1
&& pids[i] == payload->evt.event_data.exit.process_pid ) {
@ -224,6 +229,7 @@ wait4all(pid_t *pids, size_t len)
ec = WEXITSTATUS(payload->evt.event_data.exit.exit_code);
}
}
#endif
}
return ec;

Loading…
Cancel
Save