mirror of
https://repo.or.cz/socat.git
synced 2025-07-13 07:03:25 +00:00
Mitigated race condition of SYSTEM,EXEC child processes
This commit is contained in:
parent
2e0b0a0eff
commit
f34e8a4dc1
5 changed files with 45 additions and 55 deletions
|
@ -11,6 +11,7 @@
|
|||
|
||||
/*!! with socat, at most 4 exec children exist */
|
||||
pid_t diedunknown[NUMUNKNOWN]; /* children that died before they were registered */
|
||||
int statunknown[NUMUNKNOWN]; /* exit state of unknown dead child */
|
||||
size_t nextunknown;
|
||||
|
||||
|
||||
|
@ -120,7 +121,8 @@ void childdied(int signum) {
|
|||
if (nextunknown == NUMUNKNOWN) {
|
||||
nextunknown = 0;
|
||||
}
|
||||
diedunknown[nextunknown++] = pid;
|
||||
diedunknown[nextunknown] = pid;
|
||||
statunknown[nextunknown++] = WEXITSTATUS(status);
|
||||
Debug1("saving pid in diedunknown"F_Zu,
|
||||
nextunknown/*sic, for compatibility*/);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue