mirror of
https://github.com/NixOS/nix.git
synced 2025-11-13 05:56:03 +01:00
Fix the build on darwin
`MSG_NOSIGNAL` doesn’t exist on darwin, so globally ignore the `SIGPIPE` signal instead.
This commit is contained in:
parent
988c51de7f
commit
40e95a2e30
1 changed files with 5 additions and 1 deletions
|
|
@ -5,6 +5,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
using namespace nix::roots_tracer;
|
using namespace nix::roots_tracer;
|
||||||
|
|
||||||
|
|
@ -128,6 +129,9 @@ int main(int argc, char * * argv)
|
||||||
throw Error("cannot listen on socket " + opts.socketPath.string());
|
throw Error("cannot listen on socket " + opts.socketPath.string());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ignore SIGPIPE so that an interrupted connection doesn’t stop the daemon
|
||||||
|
signal(SIGPIPE, SIG_IGN);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
struct sockaddr_un remoteAddr;
|
struct sockaddr_un remoteAddr;
|
||||||
socklen_t remoteAddrLen = sizeof(remoteAddr);
|
socklen_t remoteAddrLen = sizeof(remoteAddr);
|
||||||
|
|
@ -145,7 +149,7 @@ int main(int argc, char * * argv)
|
||||||
opts.log("accepted connection");
|
opts.log("accepted connection");
|
||||||
|
|
||||||
auto printToSocket = [&](std::string_view s) {
|
auto printToSocket = [&](std::string_view s) {
|
||||||
send(remoteSocket, s.data(), s.size(), MSG_NOSIGNAL);
|
send(remoteSocket, s.data(), s.size(), 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
auto traceResult = traceStaticRoots(opts, standardRoots);
|
auto traceResult = traceStaticRoots(opts, standardRoots);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue