...
Code Block | ||
---|---|---|
| ||
#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> enum { MAXLINE = 1024 }; volatile sig_atomic_t eflag = 0; char *info = NULL; void log_message() { fprintf( stderr, info); } void handler(int signum) { eflag = 1; sleep(1); } int main(void) { signal(SIGINT, handler); info = (char*) malloc(MAXLINE); while (!eflag) { /* main loop program code */ log_message(); /* more program code */ } log_message(); free( info); return 0; } |
Risk Assessment
...