aboutsummaryrefslogtreecommitdiff
path: root/tests/server/rtspd.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2013-01-09 22:19:03 +0100
committerYang Tse <yangsita@gmail.com>2013-01-09 22:23:50 +0100
commit308cce8231b3715fad4fc5f275c47d0a479ce516 (patch)
tree89f39cecf41256d6d1af8eedea81081da139091b /tests/server/rtspd.c
parenta6848250d279026252aa35cd9f93fafccc76333c (diff)
test servers: handle W32/W64 SIGBREAK with exit_signal_handler
Diffstat (limited to 'tests/server/rtspd.c')
-rw-r--r--tests/server/rtspd.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/server/rtspd.c b/tests/server/rtspd.c
index 294dc700d..72422ecf5 100644
--- a/tests/server/rtspd.c
+++ b/tests/server/rtspd.c
@@ -228,6 +228,10 @@ static SIGHANDLER_T old_sigint_handler = SIG_ERR;
static SIGHANDLER_T old_sigterm_handler = SIG_ERR;
#endif
+#if defined(SIGBREAK) && defined(WIN32)
+static SIGHANDLER_T old_sigbreak_handler = SIG_ERR;
+#endif
+
/* var which if set indicates that the program should finish execution */
SIG_ATOMIC_T got_exit_signal = 0;
@@ -283,6 +287,13 @@ static void install_signal_handlers(void)
else
siginterrupt(SIGTERM, 1);
#endif
+#if defined(SIGBREAK) && defined(WIN32)
+ /* handle SIGBREAK signal with our exit_signal_handler */
+ if((old_sigbreak_handler = signal(SIGBREAK, exit_signal_handler)) == SIG_ERR)
+ logmsg("cannot install SIGBREAK handler: %s", strerror(errno));
+ else
+ siginterrupt(SIGBREAK, 1);
+#endif
}
static void restore_signal_handlers(void)
@@ -307,6 +318,10 @@ static void restore_signal_handlers(void)
if(SIG_ERR != old_sigterm_handler)
(void)signal(SIGTERM, old_sigterm_handler);
#endif
+#if defined(SIGBREAK) && defined(WIN32)
+ if(SIG_ERR != old_sigbreak_handler)
+ (void)signal(SIGBREAK, old_sigbreak_handler);
+#endif
}
static int ProcessRequest(struct httprequest *req)