1#include "../git-compat-util.h"
23
ssize_t git_pread(int fd, void *buf, size_t count, off_t offset)
4{
5off_t current_offset;
6ssize_t rc;
78
current_offset = lseek(fd, 0, SEEK_CUR);
910
if (lseek(fd, offset, SEEK_SET) < 0)
11return -1;
1213
rc = read_in_full(fd, buf, count);
1415
if (current_offset != lseek(fd, current_offset, SEEK_SET))
16return -1;
17return rc;
18}