diff options
author | Kenny Levinsen <kl@kl.wtf> | 2022-03-03 14:41:52 +0100 |
---|---|---|
committer | Kenny Levinsen <kl@kl.wtf> | 2022-03-03 14:44:49 +0100 |
commit | 46c83972fe66b917032a832bb8e3309ac6783d7d (patch) | |
tree | d821c5c5d979d925fc72570353ca596762e34d07 /libseat | |
parent | abcecbb53b35cfb449ce1793f98bfdee5e604a94 (diff) |
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.
Diffstat (limited to 'libseat')
-rw-r--r-- | libseat/backend/seatd.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libseat/backend/seatd.c b/libseat/backend/seatd.c index 6e90713..f55efe6 100644 --- a/libseat/backend/seatd.c +++ b/libseat/backend/seatd.c @@ -634,6 +634,7 @@ static struct libseat *builtin_open_seat(const struct libseat_seat_listener *lis close(fds[1]); return NULL; } else if (pid == 0) { + close(fds[1]); int fd = fds[0]; int res = 0; struct server server = {0}; @@ -662,6 +663,7 @@ static struct libseat *builtin_open_seat(const struct libseat_seat_listener *lis close(fd); exit(res); } else { + close(fds[0]); int fd = fds[1]; return _open_seat(listener, data, fd); } |