On Tue, 9 Jan 2007, Stefan-W. Hahn wrote:
Show 11 quoted lines
> --- /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)
> +{
> + 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.
Show 5 quoted lines
> +
> + ssize_t rc=xread(fd, buf, count);
> +
> + if (current_offset != lseek(fd, current_offset, SEEK_SET))
> + return EINVAL;
> + return rc;
> +}