Detegr / rust-ctrlc

Easy Ctrl-C handler for Rust projects
https://crates.io/crates/ctrlc
Other
599 stars 79 forks source link

Incorrect os_handler() signature #17

Closed henninglive closed 7 years ago

henninglive commented 7 years ago

The nix os_handler() needs be declared extern “C” since it is being called from libc. The current signature expects the rust calling convention, but it is being called with the C calling convention. This doesn’t crash on x64 or ARM where both C and rust pass the first arguments in registries, but will probably crash on x86 where C passes all arguments on the stack. Also, the register order is probably different, so the sig argument is probably invalid.