summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Michael Haggerty <mhagger@alum.mit.edu>2014-10-01 12:28:08 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2014-10-01 13:38:39 -0700
commit5527d5349b42aeb2ea36edfd2d55016f22fefc08 (patch)
tree9a5d552ad131f9b650f6fe796991854068dd10e8
parentclose_lock_file(): exit (successfully) if file is already closed (diff)
downloadtgif-5527d5349b42aeb2ea36edfd2d55016f22fefc08.tar.xz
rollback_lock_file(): do not clear filename redundantly
It is only necessary to clear the lock_file's filename field if it was not already clear. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Ronnie Sahlberg <sahlberg@google.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--lockfile.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lockfile.c b/lockfile.c
index d02c3bf901..5330d6ae52 100644
--- a/lockfile.c
+++ b/lockfile.c
@@ -280,6 +280,6 @@ void rollback_lock_file(struct lock_file *lk)
if (lk->fd >= 0)
close(lk->fd);
unlink_or_warn(lk->filename);
+ lk->filename[0] = 0;
}
- lk->filename[0] = 0;
}