aboutsummaryrefslogtreecommitdiff
path: root/lockfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'lockfile.c')
-rw-r--r--lockfile.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lockfile.c b/lockfile.c
index e0460275e..d098adebf 100644
--- a/lockfile.c
+++ b/lockfile.c
@@ -217,9 +217,12 @@ int hold_lock_file_for_append(struct lock_file *lk, const char *path, int flags)
if (flags & LOCK_DIE_ON_ERROR)
exit(128);
+ close(orig_fd);
rollback_lock_file(lk);
errno = save_errno;
return -1;
+ } else {
+ close(orig_fd);
}
return fd;
}