builtin: Close other end of socketpair after fork
We will not get a socket hangup if we have duplicates socket fds in the parent or child, so make sure we clean this up properly after fork.
This commit is contained in:
parent
abcecbb53b
commit
46c83972fe
1 changed files with 2 additions and 0 deletions
|
@ -634,6 +634,7 @@ static struct libseat *builtin_open_seat(const struct libseat_seat_listener *lis
|
||||||
close(fds[1]);
|
close(fds[1]);
|
||||||
return NULL;
|
return NULL;
|
||||||
} else if (pid == 0) {
|
} else if (pid == 0) {
|
||||||
|
close(fds[1]);
|
||||||
int fd = fds[0];
|
int fd = fds[0];
|
||||||
int res = 0;
|
int res = 0;
|
||||||
struct server server = {0};
|
struct server server = {0};
|
||||||
|
@ -662,6 +663,7 @@ static struct libseat *builtin_open_seat(const struct libseat_seat_listener *lis
|
||||||
close(fd);
|
close(fd);
|
||||||
exit(res);
|
exit(res);
|
||||||
} else {
|
} else {
|
||||||
|
close(fds[0]);
|
||||||
int fd = fds[1];
|
int fd = fds[1];
|
||||||
return _open_seat(listener, data, fd);
|
return _open_seat(listener, data, fd);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue