diff options
author | Michael Cardell Widerkrantz <mc@hack.org> | 2010-07-20 12:43:29 +0200 |
---|---|---|
committer | Michael Cardell Widerkrantz <mc@hack.org> | 2010-07-20 12:43:29 +0200 |
commit | fbec1d7d9fc6315fd6bbd8320785babf0894a8c3 (patch) | |
tree | e6eeb201180f769cb8e1c76501c6093625cb804f /mcwm.c | |
parent | 38c139f3b22c259235ed1632c77b573adeaa155e (diff) | |
download | mcwm-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.c | 27 |
1 files changed, 19 insertions, 8 deletions
@@ -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. */ |