From cb3e949772a082711a38a559837d8e7bbbb53016 Mon Sep 17 00:00:00 2001 From: Philipp Rudo Date: Tue, 31 Jul 2018 12:16:57 +0200 Subject: [PATCH] zfcpdump: Fix incompatible cast compile warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When zfcpdump is built you get a compile warning zfcpdump.c: In function ‘init_sig’: zfcpdump.c:307:24: warning: cast between incompatible function types from ‘void (* (*)(int, siginfo_t *, void *))(int)’ {aka ‘void (* (*)(int, struct *, void *))(int)’} to ‘void (*)(int)’ [-Wcast-function-type] g.sigact.sa_handler = (__sighandler_t)dump_sig_handler; Furthermore the man pages for sigaction says $man 2 sigaction [...] If SA_SIGINFO is specified in sa_flags, then sa_sigaction (instead of sa_handler) specifies the signal-handling function for signum. This function receives three arguments, as described below. [...] Because SA_SIGINFO is set, using sa_handler at all is wrong in this case. Fix this by giving dump_sig_handler the correct return type and assign it to sa_sigaction. Signed-off-by: Philipp Rudo Reviewed-by: Steffen Maier Signed-off-by: Jan Höppner --- zfcpdump/zfcpdump.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/zfcpdump/zfcpdump.c b/zfcpdump/zfcpdump.c index e8253089..606fdbb8 100644 --- a/zfcpdump/zfcpdump.c +++ b/zfcpdump/zfcpdump.c @@ -288,12 +288,10 @@ no_reipl: /* * Signal handler for zfcp_dumper */ -static __sighandler_t dump_sig_handler(int sig, siginfo_t *UNUSED(sip), - void *UNUSED(p)) +static void dump_sig_handler(int sig, siginfo_t *UNUSED(sip), void *UNUSED(p)) { PRINT_ERR("Got signal: %i\n", sig); terminate(1); - return NULL; } /* @@ -304,7 +302,7 @@ static __sighandler_t dump_sig_handler(int sig, siginfo_t *UNUSED(sip), static int init_sig(void) { g.sigact.sa_flags = (SA_NODEFER | SA_SIGINFO | SA_RESETHAND); - g.sigact.sa_handler = (__sighandler_t)dump_sig_handler; + g.sigact.sa_sigaction = dump_sig_handler; if (sigemptyset(&g.sigact.sa_mask) < 0) return -1; if (sigaction(SIGINT, &g.sigact, NULL) < 0)