sigwaitinfo() may fail with EINTR if interrupted by an unblocked signal not in the set
[strongswan.git] / src / charon-systemd / charon-systemd.c
index f302d45..4286cde 100644 (file)
@@ -254,6 +254,10 @@ static int run()
                sig = sigwaitinfo(&set, NULL);
                if (sig == -1)
                {
+                       if (errno == EINTR)
+                       {       /* ignore signals we didn't wait for */
+                               continue;
+                       }
                        DBG1(DBG_DMN, "waiting for signal failed: %s", strerror(errno));
                        return SS_RC_INITIALIZATION_FAILED;
                }
@@ -265,11 +269,6 @@ static int run()
                                charon->bus->alert(charon->bus, ALERT_SHUTDOWN_SIGNAL, sig);
                                return 0;
                        }
-                       default:
-                       {
-                               DBG1(DBG_DMN, "unknown signal %d received. Ignored", sig);
-                               break;
-                       }
                }
        }
 }