summaryrefslogtreecommitdiff
path: root/src/filebuf.h
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-07-24 19:22:41 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2015-07-24 23:02:11 +0200
commit19d9beb7ffbde3e171c17fc3544d508304a30fbf (patch)
tree1999c60c5fd7cb91ec7830de516896540deabde7 /src/filebuf.h
parent668053befecfd0979ff790bc9a2a3c308c38a9be (diff)
downloadlibgit2-19d9beb7ffbde3e171c17fc3544d508304a30fbf.tar.gz
filebuf: remove lockfile upon rename errorscmn/filebuf-rename-error
When we have an error renaming the lockfile, we need to make sure that we remove it upon cleanup. For this, we need to keep track of whether we opened the file and whether the rename succeeded. If we did create the lockfile but the rename did not succeed, we remove the lockfile. This won't protect against all errors, but the most common ones (target file is open) does get handled.
Diffstat (limited to 'src/filebuf.h')
-rw-r--r--src/filebuf.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/filebuf.h b/src/filebuf.h
index 2bd18dc35..f4d255b0a 100644
--- a/src/filebuf.h
+++ b/src/filebuf.h
@@ -44,6 +44,8 @@ struct git_filebuf {
size_t buf_size, buf_pos;
git_file fd;
bool fd_is_open;
+ bool created_lock;
+ bool did_rename;
bool do_not_buffer;
int last_error;
};