Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
sequencer: make lockfiles non-static
author
Martin Ågren
<martin.agren@gmail.com>
Tue, 27 Feb 2018 21:30:09 +0000
(22:30 +0100)
committer
Junio C Hamano
<gitster@pobox.com>
Tue, 27 Feb 2018 22:48:16 +0000
(14:48 -0800)
After
076aa2cbd
(tempfile: auto-allocate tempfiles on heap, 2017-09-05),
we can have lockfiles on the stack.
One of these functions fails to always roll back the lock. That will be
fixed in the next commit.
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sequencer.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
e3a8078
)
diff --git
a/sequencer.c
b/sequencer.c
index e9baaf59bd954279970367631c930fe051712cda..d9f865926d8d4c772877c271fb40e81d737eff3e 100644
(file)
--- a/
sequencer.c
+++ b/
sequencer.c
@@
-339,7
+339,7
@@
static void print_advice(int show_hint, struct replay_opts *opts)
static int write_message(const void *buf, size_t len, const char *filename,
int append_eol)
{
static int write_message(const void *buf, size_t len, const char *filename,
int append_eol)
{
- st
atic struct lock_file msg_file
;
+ st
ruct lock_file msg_file = LOCK_INIT
;
int msg_fd = hold_lock_file_for_update(&msg_file, filename, 0);
if (msg_fd < 0)
int msg_fd = hold_lock_file_for_update(&msg_file, filename, 0);
if (msg_fd < 0)
@@
-485,7
+485,7
@@
static int do_recursive_merge(struct commit *base, struct commit *next,
struct tree *result, *next_tree, *base_tree, *head_tree;
int clean;
char **xopt;
struct tree *result, *next_tree, *base_tree, *head_tree;
int clean;
char **xopt;
- st
atic struct lock_file index_lock
;
+ st
ruct lock_file index_lock = LOCK_INIT
;
if (hold_locked_index(&index_lock, LOCK_REPORT_ON_ERROR) < 0)
return -1;
if (hold_locked_index(&index_lock, LOCK_REPORT_ON_ERROR) < 0)
return -1;
@@
-1705,7
+1705,7
@@
static int prepare_revs(struct replay_opts *opts)
static int read_and_refresh_cache(struct replay_opts *opts)
{
static int read_and_refresh_cache(struct replay_opts *opts)
{
- st
atic struct lock_file index_lock
;
+ st
ruct lock_file index_lock = LOCK_INIT
;
int index_fd = hold_locked_index(&index_lock, 0);
if (read_index_preload(&the_index, NULL) < 0) {
rollback_lock_file(&index_lock);
int index_fd = hold_locked_index(&index_lock, 0);
if (read_index_preload(&the_index, NULL) < 0) {
rollback_lock_file(&index_lock);
@@
-2099,7
+2099,7
@@
static int create_seq_dir(void)
static int save_head(const char *head)
{
static int save_head(const char *head)
{
- st
atic struct lock_file head_lock
;
+ st
ruct lock_file head_lock = LOCK_INIT
;
struct strbuf buf = STRBUF_INIT;
int fd;
ssize_t written;
struct strbuf buf = STRBUF_INIT;
int fd;
ssize_t written;
@@
-2224,7
+2224,7
@@
int sequencer_rollback(struct replay_opts *opts)
static int save_todo(struct todo_list *todo_list, struct replay_opts *opts)
{
static int save_todo(struct todo_list *todo_list, struct replay_opts *opts)
{
- st
atic struct lock_file todo_lock
;
+ st
ruct lock_file todo_lock = LOCK_INIT
;
const char *todo_path = get_todo_path(opts);
int next = todo_list->current, offset, fd;
const char *todo_path = get_todo_path(opts);
int next = todo_list->current, offset, fd;