forked from auracaster/openocd
23ab2062e7
Signal handlers currently violate both C language and POSIX requirements: 1. To avoid undefined behavior (UB), variables accessed or modified by signal handlers be of atomic lock-free type. 2. The respected variables should be marked as volatile. 3. Signal handlers may only call a very limited subset of standard library functions. 4. Additionally, POSIX restricts signal handlers to signal-safe functions. This patch addresses the first two issues by changing the type of global variables that are accessed inside signal handler to `sig_atomic_t` and adding `volatile` qualifiers. Items 3 and 4 must be handled separately but are outside the scope of this change. Change-Id: I9c344e87bab9eefe7d99b0aad300a3ef4712df51 Signed-off-by: Parshintsev Anatoly <anatoly.parshintsev@syntacore.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8927 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Chris Head <chead@zaber.com>