diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-09-04 10:43:23 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-09-04 10:43:23 -0700 |
commit | 3d3caf0b78106c390fc5daceb95ee968312765dd (patch) | |
tree | d41a558b9e3cc7ad256636f103fdf243a8bf7c19 /unpack-trees.c | |
parent | fb8880dea3111deb4b1134471aa36f99285d86dc (diff) | |
parent | 74b67638166ca2e66497ede559dbf393e7af8b40 (diff) | |
download | git-3d3caf0b78106c390fc5daceb95ee968312765dd.tar.gz |
Sync with 2.4.9
Diffstat (limited to 'unpack-trees.c')
-rw-r--r-- | unpack-trees.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/unpack-trees.c b/unpack-trees.c index d6cf84904f..6e9f75549d 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -1441,15 +1441,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; + char *path; + int ret; + + path = xmemdupz(ce->name, len); if (lstat(path, &st)) - return error("cannot stat '%s': %s", path, + ret = error("cannot stat '%s': %s", path, strerror(errno)); - - return check_ok_to_remove(path, len, DT_UNKNOWN, NULL, &st, - error_type, o); + 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, |