3 Dec
2013
3 Dec
'13
8:22 p.m.
On Tue, Dec 03, 2013 at 04:27:55PM +0000, Charles Keepax wrote:
+static void sig_handler(int signum __attribute__ ((unused))) +{
- printf("Interrupted, saving what we have!\n");
- finish_record();
- if (file)
fclose(file);
- _exit(EXIT_FAILURE);
+}
You can't safely do most of this such as calling fclose() from within a signal handler, the set of functions that are guaranteed safe is quite limited - see signal(7).