| 3367 | } |
| 3368 | |
| 3369 | static int verify_bitmap_file(const struct git_hash_algo *algop, |
| 3370 | const char *name) |
| 3371 | { |
| 3372 | struct stat st; |
| 3373 | unsigned char *data; |
| 3374 | int fd = git_open(name); |
| 3375 | int res = 0; |
| 3376 | |
| 3377 | /* It is OK to not have the file. */ |
| 3378 | if (fd < 0 || fstat(fd, &st)) { |
| 3379 | if (fd >= 0) |
| 3380 | close(fd); |
| 3381 | return 0; |
| 3382 | } |
| 3383 | |
| 3384 | data = xmmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0); |
| 3385 | close(fd); |
| 3386 | if (!hashfile_checksum_valid(algop, data, st.st_size)) |
| 3387 | res = error(_("bitmap file '%s' has invalid checksum"), |
| 3388 | name); |
| 3389 | |
| 3390 | munmap(data, st.st_size); |
| 3391 | return res; |
| 3392 | } |
| 3393 | |
| 3394 | int verify_bitmap_files(struct repository *r) |
| 3395 | { |
no test coverage detected