compat / pread.con commit Merge branch 'js/maint-1.6.6-send-pack-stateless-rpc-deadlock-fix' into js/maint-send-pack-stateless-rpc-deadlock-fix (1c1f046)
   1#include "../git-compat-util.h"
   2
   3ssize_t git_pread(int fd, void *buf, size_t count, off_t offset)
   4{
   5        off_t current_offset;
   6        ssize_t rc;
   7
   8        current_offset = lseek(fd, 0, SEEK_CUR);
   9
  10        if (lseek(fd, offset, SEEK_SET) < 0)
  11                return -1;
  12
  13        rc = read_in_full(fd, buf, count);
  14
  15        if (current_offset != lseek(fd, current_offset, SEEK_SET))
  16                return -1;
  17        return rc;
  18}