MCPcopy Index your code
hub / github.com/git/git / verify_bitmap_file

Function verify_bitmap_file

pack-bitmap.c:3369–3392  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3367}
3368
3369static 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
3394int verify_bitmap_files(struct repository *r)
3395{

Callers 1

verify_bitmap_filesFunction · 0.85

Calls 3

xmmapFunction · 0.85
hashfile_checksum_validFunction · 0.85
errorFunction · 0.85

Tested by

no test coverage detected