Re: [PATCH 06/11] compat/pread: check initial lseek for errors
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Jul 15, 2026, 06:58 UTC
- Message-ID
- <alcvjynWsHZKXD84@pks.im>
- In-Reply-To
- <b31e0326e7c4f97753c80077c8f0927504f40370.1784069325.git.gitgitgadget@gmail.com>
On Tue, Jul 14, 2026 at 10:48:39PM +0000, Johannes Schindelin via GitGitGadget wrote:
Show 13 quoted lines
> diff --git a/compat/pread.c b/compat/pread.c > index 484e6d4c71..ac7d058cb8 100644 > --- a/compat/pread.c > +++ b/compat/pread.c > @@ -7,6 +7,8 @@ ssize_t git_pread(int fd, void *buf, size_t count, off_t offset) > ssize_t rc; > > current_offset = lseek(fd, 0, SEEK_CUR); > + if (current_offset < 0) > + return -1; > > if (lseek(fd, offset, SEEK_SET) < 0) > return -1;
Heh, funny. I wanted to complain about misindentation here, but your new code is actually indented correctly. It's everything else in this file that is indented with spaces.
Patrick