File tree Expand file tree Collapse file tree 1 file changed +5
-20
lines changed Expand file tree Collapse file tree 1 file changed +5
-20
lines changed Original file line number Diff line number Diff line change 11
11
*/
12
12
13
13
#include "builtin.h"
14
+ #include "tempfile.h"
14
15
#include "lockfile.h"
15
16
#include "parse-options.h"
16
17
#include "run-command.h"
@@ -42,20 +43,7 @@ static struct argv_array prune = ARGV_ARRAY_INIT;
42
43
static struct argv_array prune_worktrees = ARGV_ARRAY_INIT ;
43
44
static struct argv_array rerere = ARGV_ARRAY_INIT ;
44
45
45
- static char * pidfile ;
46
-
47
- static void remove_pidfile (void )
48
- {
49
- if (pidfile )
50
- unlink (pidfile );
51
- }
52
-
53
- static void remove_pidfile_on_signal (int signo )
54
- {
55
- remove_pidfile ();
56
- sigchain_pop (signo );
57
- raise (signo );
58
- }
46
+ static struct tempfile pidfile ;
59
47
60
48
static void git_config_date_string (const char * key , const char * * output )
61
49
{
@@ -201,7 +189,7 @@ static const char *lock_repo_for_gc(int force, pid_t* ret_pid)
201
189
int fd ;
202
190
char * pidfile_path ;
203
191
204
- if (pidfile )
192
+ if (is_tempfile_active ( & pidfile ) )
205
193
/* already locked */
206
194
return NULL ;
207
195
@@ -248,11 +236,8 @@ static const char *lock_repo_for_gc(int force, pid_t* ret_pid)
248
236
write_in_full (fd , sb .buf , sb .len );
249
237
strbuf_release (& sb );
250
238
commit_lock_file (& lock );
251
-
252
- pidfile = pidfile_path ;
253
- sigchain_push_common (remove_pidfile_on_signal );
254
- atexit (remove_pidfile );
255
-
239
+ register_tempfile (& pidfile , pidfile_path );
240
+ free (pidfile_path );
256
241
return NULL ;
257
242
}
258
243
You can’t perform that action at this time.
0 commit comments