From 4ed7cd3ab07f7c721daf4241fe1dac306fefd1fb Mon Sep 17 00:00:00 2001 From: Brandon Casey Date: Wed, 16 Jan 2008 13:12:46 -0600 Subject: Improve use of lockfile API Remove remaining double close(2)'s. i.e. close() before commit_locked_index() or commit_lock_file(). Signed-off-by: Junio C Hamano --- builtin-checkout-index.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'builtin-checkout-index.c') diff --git a/builtin-checkout-index.c b/builtin-checkout-index.c index 70d619da8d..7e42024c67 100644 --- a/builtin-checkout-index.c +++ b/builtin-checkout-index.c @@ -246,8 +246,8 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix) * want to update cache. */ if (state.refresh_cache) { - close(newfd); newfd = -1; rollback_lock_file(&lock_file); + newfd = -1; } state.refresh_cache = 0; } @@ -297,7 +297,7 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix) if (0 <= newfd && (write_cache(newfd, active_cache, active_nr) || - close(newfd) || commit_locked_index(&lock_file))) + commit_locked_index(&lock_file))) die("Unable to write new index file"); return 0; } -- cgit v1.2.3