[easytag/wip/easytag-next: 2/4] Use sigaction() rather than signal()
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/easytag-next: 2/4] Use sigaction() rather than signal()
- Date: Mon, 3 Dec 2012 22:43:00 +0000 (UTC)
commit 2beef8aaf76fcfb7e341b8d4de94c8be0febdc93
Author: David King <amigadave amigadave com>
Date: Mon Dec 3 18:26:45 2012 +0000
Use sigaction() rather than signal()
Use of signal() is discouraged, as some really old systems have signal
handlers which return int, not void.
src/easytag.c | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/easytag.c b/src/easytag.c
index f7face2..5a553fe 100644
--- a/src/easytag.c
+++ b/src/easytag.c
@@ -143,6 +143,17 @@ void Quit_Recursion_Window_Key_Press (GtkWidget *window, GdkEvent *event);
#ifndef WIN32
static void
+setup_sigbus_fpe_segv (void)
+{
+ struct sigaction sa;
+ memset (&sa, 0, sizeof (struct sigaction));
+ sa.sa_handler = Handle_Crash;
+ sigaction (SIGBUS, &sa, NULL);
+ sigaction (SIGFPE, &sa, NULL);
+ sigaction (SIGSEGV, &sa, NULL);
+}
+
+static void
sigchld_handler (int signum)
{
wait (NULL);
@@ -182,9 +193,7 @@ int main (int argc, char *argv[])
//ET_Win32_Init(hInstance);
#else
/* Signal handling to display a message(SIGSEGV, ...) */
- signal(SIGBUS,Handle_Crash);
- signal(SIGFPE,Handle_Crash);
- signal(SIGSEGV,Handle_Crash);
+ setup_sigbus_fpe_segv ();
// Must handle this signal to avoid zombie of applications executed (ex: xmms)
setup_sigchld ();
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]