summaryrefslogtreecommitdiff
path: root/src/ipcpd
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2021-09-03 18:35:52 +0200
committerSander Vrijders <sander@ouroboros.rocks>2021-09-05 17:03:42 +0200
commitb49dd2e18094697aba221a8f02cde91fe0e71955 (patch)
treee6aff7542eef63f673b97f507bede1967f6eb8e5 /src/ipcpd
parentb066b8aa71be68586e7dd88fcb530733536aa30b (diff)
downloadouroboros-b49dd2e18094697aba221a8f02cde91fe0e71955.tar.gz
ouroboros-b49dd2e18094697aba221a8f02cde91fe0e71955.zip
ipcpd: Don't use sigwaitinfo() on OS X
Apparently that function isn't implemented on some versions of OS X. On these systems, we can just use sigwait, but now the IPCP will also accept signals not coming from the IRMd. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/ipcpd')
-rw-r--r--src/ipcpd/ipcp.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/ipcpd/ipcp.c b/src/ipcpd/ipcp.c
index ab2f88f8..3e1da8c4 100644
--- a/src/ipcpd/ipcp.c
+++ b/src/ipcpd/ipcp.c
@@ -844,9 +844,12 @@ int ipcp_boot()
void ipcp_shutdown()
{
+
siginfo_t info;
sigset_t sigset;
-
+#ifdef __APPLE__
+ int sig;
+#endif
sigemptyset(&sigset);
sigaddset(&sigset, SIGINT);
sigaddset(&sigset, SIGQUIT);
@@ -856,11 +859,20 @@ void ipcp_shutdown()
while(ipcp_get_state() != IPCP_NULL &&
ipcp_get_state() != IPCP_SHUTDOWN) {
+#ifdef __APPLE__
+ if (sigwait(&sigset, &sig) < 0) {
+#else
if (sigwaitinfo(&sigset, &info) < 0) {
+#endif
log_warn("Bad signal.");
continue;
}
+#ifdef __APPLE__
+ memset(&info, 0, sizeof(info));
+ info.si_signo = sig;
+ info.si_pid = ipcpi.irmd_pid;
+#endif
switch(info.si_signo) {
case SIGINT:
case SIGTERM: