Junio C Hamano <gitster@xxxxxxxxx> writes: > Eric Wong <e@xxxxxxxxx> writes: > >> We already have pread emulation for portability, so there's >> there's no reason to make two syscalls where one suffices. >> >> Furthermore, readers of the packfile will be using mmap >> (or pread to emulate mmap), anyways, so the file description >> offset does not matter in this case. > > s/description/descriptor/ probably. > > After seeking to the packfile trailer and reading the pack id hash > using lseek+read, this helper function does not read from the file > descriptor, and the sole caller of it closes the file descriptor > immediately after it returns, which means the read file offset after > reading the packfile trailer does not matter. Oops, that was not right. When we successfully open the packfile, we leave the file descriptor open, so we do need the "we never read using read(2) from the file descriptor" guarantee for this change to be correct. But we do have the guarantee, and existing code does depend on the guarantee, so the patch is good. Thanks.