../../src/demos/signal.c: In function ‘custom_logger’: ../../src/demos/signal.c:15:5: warning: call to ‘fprintf’ from within signal handler [CWE-479] [-Wanalyzer-unsafe-call-within-signal-handler] 15 | fprintf(stderr, "LOG: %s", msg); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ‘main’: events 1-2 | | 28 | int main(int argc, const char *argv) | | ^~~~ | | | | | (1) entry to ‘main’ | 29 | { | 30 | register_handler (); | | ~~~~~~~~~~~~~~~~~~~ | | | | | (2) calling ‘register_handler’ from ‘main’ | +--> ‘register_handler’: events 3-4 | | 23 | static void register_handler () | | ^~~~~~~~~~~~~~~~ | | | | | (3) entry to ‘register_handler’ | 24 | { | 25 | signal(SIGINT, int_handler); | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (4) registering ‘int_handler’ as signal handler | event 5 | |cc1: | (5): later on, when the signal is delivered to the process | +--> ‘int_handler’: events 6-7 | | 18 | static void int_handler(int signum) | | ^~~~~~~~~~~ | | | | | (6) entry to ‘int_handler’ | 19 | { | 20 | custom_logger("got signal"); | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (7) calling ‘custom_logger’ from ‘int_handler’ | +--> ‘custom_logger’: events 8-11 | | 12 | void custom_logger(const char *msg) | | ^~~~~~~~~~~~~ | | | | | (8) entry to ‘custom_logger’ | 13 | { | 14 | if (logging) | | ~ | | | | | (9) following ‘true’ branch... | 15 | fprintf(stderr, "LOG: %s", msg); | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (10) ...to here | | (11) call to ‘fprintf’ from within signal handler |