summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-02-09 16:41:16 -0800
committerJunio C Hamano <gitster@pobox.com>2011-02-09 16:41:16 -0800
commit5bb20ece6bdb31d395667855990dc540f2940a41 (patch)
tree87fc2a99d9154250e7e4486ee1714a9f76487625
parentf5bbbf9cad167044a3560542c93faa12c90204e0 (diff)
parenta93e530184b3f7ae9d9bfb0e569734687f8d1c0b (diff)
downloadgit-5bb20ece6bdb31d395667855990dc540f2940a41.tar.gz
Merge branch 'jn/unpack-lstat-failure-report'
* jn/unpack-lstat-failure-report: unpack-trees: handle lstat failure for existing file unpack-trees: handle lstat failure for existing directory
-rw-r--r--unpack-trees.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/unpack-trees.c b/unpack-trees.c
index 1ca41b1a69..bf204b9210 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -1374,16 +1374,22 @@ static int verify_absent_1(struct cache_entry *ce,
char path[PATH_MAX + 1];
memcpy(path, ce->name, len);
path[len] = 0;
- lstat(path, &st);
+ if (lstat(path, &st))
+ return error("cannot stat '%s': %s", path,
+ strerror(errno));
return check_ok_to_remove(path, len, DT_UNKNOWN, NULL, &st,
error_type, o);
- } else if (!lstat(ce->name, &st))
+ } else if (lstat(ce->name, &st)) {
+ if (errno != ENOENT)
+ return error("cannot stat '%s': %s", ce->name,
+ strerror(errno));
+ return 0;
+ } else {
return check_ok_to_remove(ce->name, ce_namelen(ce),
- ce_to_dtype(ce), ce, &st,
- error_type, o);
-
- return 0;
+ ce_to_dtype(ce), ce, &st,
+ error_type, o);
+ }
}
static int verify_absent(struct cache_entry *ce,