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

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-12-06 04:54:10 +0300
committerJunio C Hamano <gitster@pobox.com>2008-12-08 06:08:15 +0300
commitb96524f83aa6ba7bd08fb59bb0aa07453a984a8d (patch)
tree750c820ac8f05d7f90636401a85919943e240dfd /builtin-checkout.c
parentf371d3ea3ca7933df787230f2eb9b67901bde9d3 (diff)
builtin-checkout.c: check error return from read_cache()
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-checkout.c')
-rw-r--r--builtin-checkout.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/builtin-checkout.c b/builtin-checkout.c
index 7f3bd7bb1c..c2c05613b6 100644
--- a/builtin-checkout.c
+++ b/builtin-checkout.c
@@ -228,7 +228,8 @@ static int checkout_paths(struct tree *source_tree, const char **pathspec,
struct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file));
newfd = hold_locked_index(lock_file, 1);
- read_cache();
+ if (read_cache() < 0)
+ return error("corrupt index file");
if (source_tree)
read_tree_some(source_tree, pathspec);
@@ -371,7 +372,9 @@ static int merge_working_tree(struct checkout_opts *opts,
int ret;
struct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file));
int newfd = hold_locked_index(lock_file, 1);
- read_cache();
+
+ if (read_cache() < 0)
+ return error("corrupt index file");
if (opts->force) {
ret = reset_tree(new->commit->tree, opts, 1);