Add ugly cast for our siginfo_t forward declaration.
authorThomas Jarosch <thomas.jarosch@intra2net.com>
Mon, 17 Jun 2013 15:03:05 +0000 (17:03 +0200)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Mon, 17 Jun 2013 15:03:05 +0000 (17:03 +0200)
gcc complained:
/root/rpmbuild/BUILD/libi2ncommon-2.4/utils/signalfunc.cpp: In function ‘bool I2n::SystemTools::install_signal_handler(I2n::SystemTools::Signal, void (*)(int, siginfo*, void*))’:
/root/rpmbuild/BUILD/libi2ncommon-2.4/utils/signalfunc.cpp:370: error: invalid static_cast from type ‘void (*)(int, siginfo*, void*)’ to type ‘void (*)(int, siginfo_t*, void*)’

We can get away with casting function pointer types on x86:
http://stackoverflow.com/questions/559581/casting-a-function-pointer-to-another-type

Not sure if it's really worth to avoid including signal.h from signalfunc.hpp...

utils/signalfunc.cpp

index bee98b6..a937b43 100644 (file)
@@ -367,7 +367,7 @@ bool install_signal_handler(
 )
 {
     struct sigaction new_action;
-    new_action.sa_sigaction= handler;
+    new_action.sa_sigaction= (void (*)(int, siginfo_t*, void*))(handler);
     sigemptyset( &new_action.sa_mask );
     new_action.sa_flags= SA_SIGINFO;
     new_action.sa_restorer= NULL;