Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@elego.de>2011-06-07 19:03:07 +0400
committerCarlos Martín Nieto <cmn@elego.de>2011-06-07 19:05:40 +0400
commitbb9272dd7af68590452cbf91b0b8583e22f0c066 (patch)
tree458929d9098156b2351971005648385ec8198214 /src/filebuf.c
parent8102a961b83afdee7341f2fc4bbb9fc3d9efd295 (diff)
filebuf cleanup: only unlink lockfile if we've opened it
Add a check for the file descriptor in git_filebuf_cleanup. Without it, an existing lockfile would be deleted if we tried to acquire it (but failed, as the lockfile already existed). Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Diffstat (limited to 'src/filebuf.c')
-rw-r--r--src/filebuf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/filebuf.c b/src/filebuf.c
index d0579b16b..ca13e6181 100644
--- a/src/filebuf.c
+++ b/src/filebuf.c
@@ -75,7 +75,7 @@ void git_filebuf_cleanup(git_filebuf *file)
if (file->fd >= 0)
gitfo_close(file->fd);
- if (file->path_lock && gitfo_exists(file->path_lock) == GIT_SUCCESS)
+ if (file->fd >= 0 && file->path_lock && gitfo_exists(file->path_lock) == GIT_SUCCESS)
gitfo_unlink(file->path_lock);
if (file->digest)