Skip to content

Commit

Permalink
Merge branch 'jn/unpack-lstat-failure-report'
Browse files Browse the repository at this point in the history
* jn/unpack-lstat-failure-report:
  unpack-trees: handle lstat failure for existing file
  unpack-trees: handle lstat failure for existing directory
  • Loading branch information
Junio C Hamano committed Feb 10, 2011
2 parents f5bbbf9 + a93e530 commit 5bb20ec
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions unpack-trees.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 5bb20ec

Please sign in to comment.