mirror of https://github.com/ArduPilot/ardupilot
AP_HAL_Linux: RPI: set signal handler iff nobody has already done it before
This commit is contained in:
parent
5e8edcb1db
commit
8d2b587f71
|
@ -378,10 +378,14 @@ void RCInput_RPI::set_sigaction()
|
|||
{
|
||||
for (int i = 0; i < NSIG; i++) {
|
||||
//catch all signals (like ctrl+c, ctrl+z, ...) to ensure DMA is disabled
|
||||
struct sigaction sa;
|
||||
struct sigaction sa, sa_old;
|
||||
memset(&sa, 0, sizeof(sa));
|
||||
sigaction(i, nullptr, &sa_old);
|
||||
|
||||
if (sa_old.sa_handler == nullptr) {
|
||||
sa.sa_handler = RCInput_RPI::termination_handler;
|
||||
sigaction(i, &sa, NULL);
|
||||
sigaction(i, &sa, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue