1
0
Fork 0
mirror of https://repo.or.cz/socat.git synced 2025-07-07 21:36:32 +00:00

Replaced SIGUSR1 with socketpair for synchronization between parent and child processes on RECVFROM type addresses

This commit is contained in:
Gerhard Rieger 2023-06-23 22:48:26 +02:00
parent a0e17a813a
commit 02483ff39e
12 changed files with 269 additions and 257 deletions

View file

@ -217,6 +217,15 @@ pid_t xio_fork(bool subchild, int level) {
if (!subchild) {
/* set SOCAT_PID to new value */
xiosetenvulong("PID", pid, 1);
} else {
/* Make sure the sub process does not hold the trigger pipe open */
if (sock1 != NULL) {
struct single *sfd;
sfd = XIO_RDSTREAM(sock1);
if (sfd->triggerfd >= 0) Close(sfd->triggerfd);
sfd = XIO_WRSTREAM(sock1);
if (sfd->triggerfd >= 0) Close(sfd->triggerfd);
}
}
/* gdb recommends to have env controlled sleep after fork */
if (forkwaitstring = getenv("SOCAT_FORK_WAIT")) {