Skip to content

Commit 8d9e030

Browse files
committed
tempfile: use cleanup api
1 parent cd409c5 commit 8d9e030

1 file changed

Lines changed: 2 additions & 15 deletions

File tree

tempfile.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
#include "abspath.h"
4949
#include "path.h"
5050
#include "tempfile.h"
51-
#include "sigchain.h"
51+
#include "cleanup.h"
5252

5353
static VOLATILE_LIST_HEAD(tempfile_list);
5454

@@ -87,18 +87,6 @@ static void remove_tempfiles(int in_signal_handler)
8787
}
8888
}
8989

90-
static void remove_tempfiles_on_exit(void)
91-
{
92-
remove_tempfiles(0);
93-
}
94-
95-
static void remove_tempfiles_on_signal(int signo)
96-
{
97-
remove_tempfiles(1);
98-
sigchain_pop(signo);
99-
raise(signo);
100-
}
101-
10290
static struct tempfile *new_tempfile(void)
10391
{
10492
struct tempfile *tempfile = xmalloc(sizeof(*tempfile));
@@ -116,8 +104,7 @@ static void activate_tempfile(struct tempfile *tempfile)
116104
static int initialized;
117105

118106
if (!initialized) {
119-
sigchain_push_common(remove_tempfiles_on_signal);
120-
atexit(remove_tempfiles_on_exit);
107+
cleanup_register(remove_tempfiles);
121108
initialized = 1;
122109
}
123110

0 commit comments

Comments
 (0)