зеркало из https://github.com/microsoft/git.git
Merge branch 'mm/empty-loose-error-message' into maint
* mm/empty-loose-error-message: fsck: give accurate error message on empty loose object files
This commit is contained in:
Коммит
c6a4e3f7a7
|
@ -1202,6 +1202,11 @@ void *map_sha1_file(const unsigned char *sha1, unsigned long *size)
|
||||||
|
|
||||||
if (!fstat(fd, &st)) {
|
if (!fstat(fd, &st)) {
|
||||||
*size = xsize_t(st.st_size);
|
*size = xsize_t(st.st_size);
|
||||||
|
if (!*size) {
|
||||||
|
/* mmap() is forbidden on empty files */
|
||||||
|
error("object file %s is empty", sha1_file_name(sha1));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
map = xmmap(NULL, *size, PROT_READ, MAP_PRIVATE, fd, 0);
|
map = xmmap(NULL, *size, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||||
}
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче