summaryrefslogtreecommitdiff
path: root/mcwm.c
diff options
context:
space:
mode:
authorMichael Cardell Widerkrantz <mc@hack.org>2010-07-20 12:43:29 +0200
committerMichael Cardell Widerkrantz <mc@hack.org>2010-07-20 12:43:29 +0200
commitfbec1d7d9fc6315fd6bbd8320785babf0894a8c3 (patch)
treee6eeb201180f769cb8e1c76501c6093625cb804f /mcwm.c
parent38c139f3b22c259235ed1632c77b573adeaa155e (diff)
downloadmcwm-fbec1d7d9fc6315fd6bbd8320785babf0894a8c3.zip
Use signal() instead of sigaction() so we can compile cleanly with C99
on modern GCCs and Linux. Cast to void * when using %p.
Diffstat (limited to 'mcwm.c')
-rw-r--r--mcwm.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/mcwm.c b/mcwm.c
index 5ee5c3c..7a8dbe4 100644
--- a/mcwm.c
+++ b/mcwm.c
@@ -426,7 +426,7 @@ int32_t getwmdesktop(xcb_drawable_t win)
ws = *wsp;
- PDEBUG("got _NET_WM_DESKTOP: %d stored at %p.\n", ws, wsp);
+ PDEBUG("got _NET_WM_DESKTOP: %d stored at %p.\n", ws, (void *)wsp);
free(reply);
@@ -2628,15 +2628,26 @@ int main(int argc, char **argv)
char *focuscol;
char *unfocuscol;
char *fixedcol;
- struct sigaction sigact; /* Signal handler. */
-
/* Install signal handlers. */
- sigact.sa_flags = 0;
- sigact.sa_handler = sigcatch;
- sigaction(SIGINT, &sigact, NULL);
- sigaction(SIGSEGV, &sigact, NULL);
- sigaction(SIGTERM, &sigact, NULL);
+
+ if (SIG_ERR == signal(SIGINT, sigcatch))
+ {
+ perror("mcwm: signal");
+ exit(1);
+ }
+
+ if (SIG_ERR == signal(SIGSEGV, sigcatch))
+ {
+ perror("mcwm: signal");
+ exit(1);
+ }
+
+ if (SIG_ERR == signal(SIGTERM, sigcatch))
+ {
+ perror("mcwm: signal");
+ exit(1);
+ }
/* Set up defaults. */