unpack-trees: handle lstat failure for existing file
[gitweb.git] / unpack-trees.c
index 3011d9b904015afea46b85da8124729a1b77bd4a..24227fc6c697f6b249149e404e21df71ac7fbc06 100644 (file)
@@ -1193,7 +1193,9 @@ 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);