Re: [PATCH 06/11] compat/pread: check initial lseek for errors

Johannes Schindelin <[email protected]> Wed, 5 Aug 2026 16:29:26 +0200 (CEST)
Newsgroups org.kernel.vger.git
Message-ID <[email protected]>
Hi Patrick,

On Wed, 15 Jul 2026, Patrick Steinhardt wrote:

> On Tue, Jul 14, 2026 at 10:48:39PM +0000, Johannes Schindelin via GitGitGadget wrote:
> > 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.

Heh. I did notice something odd going on, thinking that Opus ignored my
clear instructions about tab-indentation once again when I replaced the
spaces by tabs...

Ciao,
Johannes