"Stefan-W. Hahn" <stefan.hahn@xxxxxxxxx> writes: > Using cygwin with cygwin.dll before 1.5.22 the system call pread() is buggy. > This patch introduces NO_PREAD. If NO_PREAD is set git uses a sequence of > lseek()/xread()/lseek() to emulate pread. > > Signed-off-by: Stefan-W. Hahn <stefan.hahn@xxxxxxxxx> Thanks. > +# Define NO_PREAD if you have a problem with pread() system call (i.e. > +# cygwin.dll before v1.5.22). > +# I would have preferred e.g. not i.e.. > diff --git a/compat/pread.c b/compat/pread.c > new file mode 100644 > index 0000000..cd1da87 > --- /dev/null > +++ b/compat/pread.c > @@ -0,0 +1,15 @@ > +#include "../git-compat-util.h" > + > +ssize_t git_pread(int fd,void *buf,size_t count,off_t offset) Style: s/,/, /; applies to git-compat-util.h as well. > +{ > + off_t current_offset = lseek(fd, 0, SEEK_CUR); > + > + if (lseek(fd, offset, SEEK_SET) < 0) > + return EINVAL; > + > + ssize_t rc=xread(fd, buf, count); Style: please don't have declaration after statement. Yes, it is in the more recent ANSI, but the rest of git has avoided it so far and having the decls upfront makes it easier to read. I do not think you would want to return EINVAL. Andy's read_in_full() is now on 'master' so please use it instead to avoid short read. - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html