aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/utils/utils.c
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2015-11-13 15:46:27 +0100
committerTobias Brunner <tobias@strongswan.org>2015-11-13 18:24:45 +0100
commitef4279f2e5aa9881855ed608cb81062c3676f077 (patch)
treea26bdefc5ff700204dd7b800a849ef9c02d5716e /src/libstrongswan/utils/utils.c
parent1c1f71343178b35b68265b33093389625a7b2ed6 (diff)
downloadstrongswan-ef4279f2e5aa9881855ed608cb81062c3676f077.tar.bz2
strongswan-ef4279f2e5aa9881855ed608cb81062c3676f077.tar.xz
utils: Provide a fallback for sigwaitinfo() if needed
Apparently, not available on Mac OS X 10.10 Yosemite. We don't provide this on Windows.
Diffstat (limited to 'src/libstrongswan/utils/utils.c')
-rw-r--r--src/libstrongswan/utils/utils.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/libstrongswan/utils/utils.c b/src/libstrongswan/utils/utils.c
index fca614ef4..47d72ee98 100644
--- a/src/libstrongswan/utils/utils.c
+++ b/src/libstrongswan/utils/utils.c
@@ -20,6 +20,7 @@
#include <unistd.h>
#include <limits.h>
#include <ctype.h>
+#include <errno.h>
#ifndef WIN32
# include <signal.h>
#endif
@@ -126,7 +127,26 @@ void wait_sigint()
sigwaitinfo(&set, NULL);
}
-#endif
+#ifndef HAVE_SIGWAITINFO
+int sigwaitinfo(const sigset_t *set, void *info)
+{
+ int sig, err;
+
+ if (info)
+ { /* we don't replicate siginfo_t, fail if anybody tries to use it */
+ errno = EINVAL;
+ return -1;
+ }
+ err = sigwait(set, &sig);
+ if (err != 0)
+ {
+ errno = err;
+ sig = -1;
+ }
+ return sig;
+}
+#endif /* HAVE_SIGWAITINFO */
+#endif /* WIN32 */
#ifndef HAVE_CLOSEFROM
/**