summaryrefslogtreecommitdiff
path: root/ossig.h
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2016-10-05 20:29:01 -0400
committerJeffrey Walton <noloader@gmail.com>2016-10-05 20:29:01 -0400
commit74dc41703d72516baa7a3d6cd46dcc7b138806d4 (patch)
tree5f90d4c84688963a6bd0df3c99c35bf80df98894 /ossig.h
parentdc927defa1b7d1463477be401ab5d62417d44ead (diff)
downloadcryptopp-git-74dc41703d72516baa7a3d6cd46dcc7b138806d4.tar.gz
Fix Cygwin compile error due to sigemptyset (Issue 315)
Diffstat (limited to 'ossig.h')
-rw-r--r--ossig.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/ossig.h b/ossig.h
index 8764c167..35e8f789 100644
--- a/ossig.h
+++ b/ossig.h
@@ -82,12 +82,16 @@ struct SignalHandler
// Don't step on another's handler if Overwrite=false
if (m_old.sa_handler != 0 && !O) break;
- // Sun Studio 12.2-12.4 needs the two casts, and they must be C-style casts
- new_handler.sa_handler = (pfn ? pfn : &NullSignalHandler);
- new_handler.sa_flags = (pfn ? flags : 0);
-
+#if defined __CYGWIN__
+ // http://github.com/weidai11/cryptopp/issues/315
+ memset(&new_handler, 0x00, sizeof(new_handler));
+#else
ret = sigemptyset (&new_handler.sa_mask);
if (ret != 0) break; // Failed
+#endif
+
+ new_handler.sa_handler = (pfn ? pfn : &NullSignalHandler);
+ new_handler.sa_flags = (pfn ? flags : 0);
// Install it
ret = sigaction (S, &new_handler, 0);