sfnt2fnt: Clean output files when aborting on a signal.
This commit is contained in:
parent
4e07d0d6d9
commit
4ca7a064fa
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
@ -113,6 +114,11 @@ static void cleanup(void)
|
|||
if (output_name) unlink( output_name );
|
||||
}
|
||||
|
||||
static void exit_on_signal( int sig )
|
||||
{
|
||||
exit(1); /* this will call the atexit functions */
|
||||
}
|
||||
|
||||
static void error(const char *s, ...) __attribute__((format (printf, 1, 2)));
|
||||
|
||||
static void error(const char *s, ...)
|
||||
|
@ -479,6 +485,12 @@ int main(int argc, char **argv)
|
|||
sprintf(output, "%s-%d-%d-%d.fnt", name, enc, dpi, ppem);
|
||||
|
||||
atexit( cleanup );
|
||||
signal( SIGTERM, exit_on_signal );
|
||||
signal( SIGINT, exit_on_signal );
|
||||
#ifdef SIGHUP
|
||||
signal( SIGHUP, exit_on_signal );
|
||||
#endif
|
||||
|
||||
fp = fopen(output, "w");
|
||||
output_name = output;
|
||||
|
||||
|
|
Loading…
Reference in New Issue