From d31d8cea234bc9a09f0c9c2bdd8bb1f6d87aa5a4 Mon Sep 17 00:00:00 2001 From: Simul Piscator Date: Wed, 8 Nov 2023 22:50:42 +0100 Subject: [PATCH] Fix compilation on macOS --- zeroconf/networkhotplugnotifier.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zeroconf/networkhotplugnotifier.cpp b/zeroconf/networkhotplugnotifier.cpp index fdbf21c..7b99d7b 100644 --- a/zeroconf/networkhotplugnotifier.cpp +++ b/zeroconf/networkhotplugnotifier.cpp @@ -40,6 +40,7 @@ struct NetworkHotplugNotifier::Private Private(NetworkHotplugNotifier* pNotifier) : mpNotifier(pNotifier), mPipeWriteFd(-1), mPipeReadFd(-1) { +#if !__APPLE__ int fds[2]; if (::pipe(fds) < 0) { std::cerr << "Could not create socket pair " << errno << std::endl; @@ -48,15 +49,18 @@ struct NetworkHotplugNotifier::Private mPipeReadFd = fds[0]; mPipeWriteFd = fds[1]; mThread = std::thread([this]() { hotplugThread(); }); +#endif // !__APPLE__ } ~Private() { +#if !__APPLE__ char c = '0'; ::write(mPipeWriteFd, &c, 1); mThread.join(); ::close(mPipeWriteFd); ::close(mPipeReadFd); +#endif // !__APPLE__ } void hotplugThread()