Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/compat/pread.c # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / compat / pread.c` 21 lines ยท 495 bytes Raw Blame History 1 #include "../git-compat-util.h" 2 #include "../wrapper.h" 3 4 ssize_t git_pread(int fd, void *buf, size_t count, off_t offset) 5 { 6 off_t current_offset; 7 ssize_t rc; 8 9 current_offset = lseek(fd, 0, SEEK_CUR); 10 if (current_offset < 0) 11 return -1; 12 13 if (lseek(fd, offset, SEEK_SET) < 0) 14 return -1; 15 16 rc = read_in_full(fd, buf, count); 17 18 if (current_offset != lseek(fd, current_offset, SEEK_SET)) 19 return -1; 20 return rc; 21 }