summaryrefslogtreecommitdiff
path: root/builtin-checkout-index.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin-checkout-index.c')
-rw-r--r--builtin-checkout-index.c4
1 files changed, 2 insertions, 2 deletions
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;
}