We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c1b4ab4 commit b56bf21Copy full SHA for b56bf21
src/mp/util.cpp
@@ -110,10 +110,12 @@ int SpawnProcess(int& pid, FdToArgsFn&& fd_to_args)
110
if (pid == -1) {
111
throw std::system_error(errno, std::system_category(), "fork");
112
}
113
+ // Parent process closes the descriptor for socket 0, child closes the descriptor for socket 1.
114
if (close(fds[pid ? 0 : 1]) != 0) {
115
throw std::system_error(errno, std::system_category(), "close");
116
117
if (!pid) {
118
+ // Child process must close all potentially open descriptors, except socket 0.
119
int maxFd = MaxFd();
120
for (int fd = 3; fd < maxFd; ++fd) {
121
if (fd != fds[0]) {
0 commit comments