Sync with 2.2.3

This commit is contained in:
Junio C Hamano
2015-09-04 10:29:28 -07:00
6 changed files with 39 additions and 26 deletions

View File

@ -1434,15 +1434,18 @@ static int verify_absent_1(const struct cache_entry *ce,
if (!len)
return 0;
else if (len > 0) {
char path[PATH_MAX + 1];
memcpy(path, ce->name, len);
path[len] = 0;
if (lstat(path, &st))
return error("cannot stat '%s': %s", path,
strerror(errno));
char *path;
int ret;
return check_ok_to_remove(path, len, DT_UNKNOWN, NULL, &st,
error_type, o);
path = xmemdupz(ce->name, len);
if (lstat(path, &st))
ret = error("cannot stat '%s': %s", path,
strerror(errno));
else
ret = check_ok_to_remove(path, len, DT_UNKNOWN, NULL,
&st, error_type, o);
free(path);
return ret;
} else if (lstat(ce->name, &st)) {
if (errno != ENOENT)
return error("cannot stat '%s': %s", ce->name,