aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2021-12-13 17:16:46 +0100
committerEelco Dolstra <edolstra@gmail.com>2021-12-13 18:59:50 +0100
commit6d30f9e6fea7d451033653f8f167aef58f7f5347 (patch)
treecafe56e3fa47407dc0a5545cc643b92b28fe58c1 /src
parentf133001dc8c849053b8af9933902d11f274426bd (diff)
Explicitly make GC roots client sockets blocking
On macOS / BSD, these sockets inherit the non-blocking flag of the server soocket, which is not what we want. https://github.com/dotnet/runtime/issues/25069 https://bugs.python.org/issue7995 https://hydra.nixos.org/build/161439304
Diffstat (limited to 'src')
-rw-r--r--src/libstore/gc.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc
index 7a414da6b..ee123d84e 100644
--- a/src/libstore/gc.cc
+++ b/src/libstore/gc.cc
@@ -535,6 +535,12 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
}
});
+ /* On macOS, accepted sockets inherit the
+ non-blocking flag from the server socket, so
+ explicitly make it blocking. */
+ if (fcntl(fdServer.get(), F_SETFL, fcntl(fdServer.get(), F_GETFL) & ~O_NONBLOCK) == -1)
+ abort();
+
while (true) {
try {
auto path = readLine(fdClient.get());