Skip to content

Commit 98b1d11

Browse files
committed
http-push: use cleanup api
Note that this adds an atexit handler, which we didn't have before. Is that OK?
1 parent d4b95ed commit 98b1d11

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

http-push.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "object-file.h"
2323
#include "odb.h"
2424
#include "commit-reach.h"
25+
#include "cleanup.h"
2526

2627
#ifdef EXPAT_NEEDS_XMLPARSE_H
2728
#include <xmlparse.h>
@@ -997,7 +998,7 @@ static int unlock_remote(struct remote_lock *lock)
997998
return rc;
998999
}
9991000

1000-
static void remove_locks(void)
1001+
static void remove_locks(int in_signal_handler UNUSED)
10011002
{
10021003
struct remote_lock *lock = repo->locks;
10031004

@@ -1009,13 +1010,6 @@ static void remove_locks(void)
10091010
}
10101011
}
10111012

1012-
static void remove_locks_on_signal(int signo)
1013-
{
1014-
remove_locks();
1015-
sigchain_pop(signo);
1016-
raise(signo);
1017-
}
1018-
10191013
static void remote_ls(const char *path, int flags,
10201014
void (*userFunc)(struct remote_ls_ctx *ls),
10211015
void *userData);
@@ -1802,7 +1796,7 @@ int cmd_main(int argc, const char **argv)
18021796
goto cleanup;
18031797
}
18041798

1805-
sigchain_push_common(remove_locks_on_signal);
1799+
cleanup_register(remove_locks);
18061800

18071801
/* Check whether the remote has server info files */
18081802
repo->can_update_info_refs = 0;

0 commit comments

Comments
 (0)