Replacing the system call pread() with lseek()/xread()/lseek() sequence.
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
compat/pread.c line 8
Quoted 11 lines · Stefan-W. Hahn
compat/pread.c new file +8
-0@@ -0,0 +1,15 @@ +#include "../git-compat-util.h" + +ssize_t git_pread (int fd,void *buf,size_t count,off_t offset) +{ +off_t current_offset =lseek (fd,0 ,SEEK_CUR ); + +if (lseek (fd, offset,SEEK_SET ) <0 ) +return EINVAL ;
You certainly wanted to return -1 here.
compat/pread.c line 13
Quoted 5 lines
compat/pread.c new file +5
-0+ +ssize_t rc=xread (fd, buf, count); + +if (current_offset !=lseek (fd, current_offset,SEEK_SET )) +return EINVAL ;
Ditto here.
compat/pread.c line 15
Quoted 2 lines
compat/pread.c new file +2
-0+return rc; +}
Nicolas