File tree Expand file tree Collapse file tree 5 files changed +26
-10
lines changed
Expand file tree Collapse file tree 5 files changed +26
-10
lines changed Original file line number Diff line number Diff line change @@ -240,10 +240,10 @@ fn main() -> Result<(), Box<dyn Error>> {
240240 // extern "C" function handlers. All handlers are async-signal-safe
241241 // (they only perform atomic stores or call async-signal-safe functions).
242242 unsafe {
243- libc:: signal ( libc:: SIGHUP , handle_sighup as usize ) ;
244- libc:: signal ( libc:: SIGCHLD , handle_sigchld as usize ) ;
245- libc:: signal ( libc:: SIGTERM , handle_shutdown as usize ) ;
246- libc:: signal ( libc:: SIGINT , handle_shutdown as usize ) ;
243+ libc:: signal ( libc:: SIGHUP , handle_sighup as * const ( ) as usize ) ;
244+ libc:: signal ( libc:: SIGCHLD , handle_sigchld as * const ( ) as usize ) ;
245+ libc:: signal ( libc:: SIGTERM , handle_shutdown as * const ( ) as usize ) ;
246+ libc:: signal ( libc:: SIGINT , handle_shutdown as * const ( ) as usize ) ;
247247 }
248248
249249 // Run @reboot jobs at startup
Original file line number Diff line number Diff line change @@ -622,7 +622,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
622622
623623 // Install SIGINT handler
624624 unsafe {
625- libc:: signal ( libc:: SIGINT , sigint_handler as libc:: sighandler_t ) ;
625+ libc:: signal (
626+ libc:: SIGINT ,
627+ sigint_handler as * const ( ) as libc:: sighandler_t ,
628+ ) ;
626629 }
627630
628631 let args: Vec < String > = std:: env:: args ( ) . skip ( 1 ) . collect ( ) ;
Original file line number Diff line number Diff line change @@ -1821,7 +1821,7 @@ pub fn register_signals() {
18211821
18221822 // Register the `handle_signals` function for each signal
18231823 for & sig in signals {
1824- if signal ( sig, handle_signals as usize ) == libc:: SIG_ERR {
1824+ if signal ( sig, handle_signals as * const ( ) as usize ) == libc:: SIG_ERR {
18251825 eprintln ! ( "Failed to register signal handler for signal {}" , sig) ;
18261826 }
18271827 }
Original file line number Diff line number Diff line change @@ -494,9 +494,18 @@ extern "C" fn handle_signal(_sig: libc::c_int) {
494494fn register_signals ( socket_path : & Path ) {
495495 unsafe {
496496 SOCKET_PATH = Some ( socket_path. to_path_buf ( ) ) ;
497- libc:: signal ( libc:: SIGINT , handle_signal as libc:: sighandler_t ) ;
498- libc:: signal ( libc:: SIGTERM , handle_signal as libc:: sighandler_t ) ;
499- libc:: signal ( libc:: SIGQUIT , handle_signal as libc:: sighandler_t ) ;
497+ libc:: signal (
498+ libc:: SIGINT ,
499+ handle_signal as * const ( ) as libc:: sighandler_t ,
500+ ) ;
501+ libc:: signal (
502+ libc:: SIGTERM ,
503+ handle_signal as * const ( ) as libc:: sighandler_t ,
504+ ) ;
505+ libc:: signal (
506+ libc:: SIGQUIT ,
507+ handle_signal as * const ( ) as libc:: sighandler_t ,
508+ ) ;
500509 }
501510}
502511
Original file line number Diff line number Diff line change @@ -249,7 +249,11 @@ extern "C" fn handle_sigint(_sig: libc::c_int) {
249249/// Register signal handler for SIGINT
250250fn register_sigint_handler ( ) {
251251 unsafe {
252- if libc:: signal ( libc:: SIGINT , handle_sigint as libc:: sighandler_t ) == libc:: SIG_ERR {
252+ if libc:: signal (
253+ libc:: SIGINT ,
254+ handle_sigint as * const ( ) as libc:: sighandler_t ,
255+ ) == libc:: SIG_ERR
256+ {
253257 eprintln ! ( "{}" , gettext( "Failed to register signal handler" ) ) ;
254258 }
255259 }
You can’t perform that action at this time.
0 commit comments