Fix Cygwin compile error due to sigemptyset (Issue 315)

pull/326/head
Jeffrey Walton 2016-10-05 20:29:01 -04:00
parent dc927defa1
commit 74dc41703d
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
1 changed files with 8 additions and 4 deletions

12
ossig.h
View File

@ -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);