diff options
author | Ryan Pavlik <rpavlik@iastate.edu> | 2011-10-28 16:59:51 (GMT) |
---|---|---|
committer | Ryan Pavlik <rpavlik@iastate.edu> | 2011-10-31 15:50:26 (GMT) |
commit | cc1193ef0caaf5de9d7d1f443a7e90f44f5277a1 (patch) | |
tree | 9c0c3600a38168eec5a5cfa87f50570584d8fee1 | |
parent | f40be36f7567a78423f93bb291ef61fe62f5337a (diff) | |
download | fluxbox_paul-cc1193ef0caaf5de9d7d1f443a7e90f44f5277a1.zip fluxbox_paul-cc1193ef0caaf5de9d7d1f443a7e90f44f5277a1.tar.bz2 |
FbTk/SignalHandler.cc: Use HAVE_SIGACTION, with signal() fallback
This fixes platforms without sigaction, like Windows.
-rw-r--r-- | src/FbTk/SignalHandler.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/FbTk/SignalHandler.cc b/src/FbTk/SignalHandler.cc index a0a4c4c..5f06210 100644 --- a/src/FbTk/SignalHandler.cc +++ b/src/FbTk/SignalHandler.cc | |||
@@ -46,6 +46,7 @@ bool SignalHandler::registerHandler(int signum, SignalEventHandler *eh, | |||
46 | if (oldhandler_ret != 0) | 46 | if (oldhandler_ret != 0) |
47 | *oldhandler_ret = s_signal_handler[signum]; | 47 | *oldhandler_ret = s_signal_handler[signum]; |
48 | 48 | ||
49 | #ifdef HAVE_SIGACTION | ||
49 | struct sigaction sa; | 50 | struct sigaction sa; |
50 | // set callback | 51 | // set callback |
51 | sa.sa_handler = SignalHandler::handleSignal; | 52 | sa.sa_handler = SignalHandler::handleSignal; |
@@ -54,7 +55,12 @@ bool SignalHandler::registerHandler(int signum, SignalEventHandler *eh, | |||
54 | 55 | ||
55 | if (sigaction(signum, &sa, 0) == -1) | 56 | if (sigaction(signum, &sa, 0) == -1) |
56 | return false; | 57 | return false; |
57 | 58 | #else | |
59 | // Fallback code for Windows and other platforms lacking sigaction. | ||
60 | if (signal(signum, &SignalHandler::handleSignal) == SIG_ERR) { | ||
61 | return false; | ||
62 | } | ||
63 | #endif | ||
58 | s_signal_handler[signum] = eh; | 64 | s_signal_handler[signum] = eh; |
59 | 65 | ||
60 | return true; | 66 | return true; |