Re: git: 33424fd50ee0 - main - diff3: plug fd leak

From: Baptiste Daroussin <bapt_at_freebsd.org>
Date: Sat, 28 Mar 2026 08:44:22 UTC
On Sat 28 Mar 02:40, Konstantin Belousov wrote:
> On Thu, Mar 26, 2026 at 07:41:10AM +0000, Baptiste Daroussin wrote:
> > The branch main has been updated by bapt:
> > 
> > URL: https://cgit.FreeBSD.org/src/commit/?id=33424fd50ee0333bc6f70b5b14a270b85e5b5de1
> > 
> > commit 33424fd50ee0333bc6f70b5b14a270b85e5b5de1
> > Author:     Baptiste Daroussin <bapt@FreeBSD.org>
> > AuthorDate: 2026-03-26 07:40:29 +0000
> > Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
> > CommitDate: 2026-03-26 07:40:29 +0000
> > 
> >     diff3: plug fd leak
> >     
> >     MFC After:      1 week
> >     Reported by:    kib
> > ---
> >  usr.bin/diff3/diff3.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/usr.bin/diff3/diff3.c b/usr.bin/diff3/diff3.c
> > index 75e8c6297855..8212b51e15a2 100644
> > --- a/usr.bin/diff3/diff3.c
> > +++ b/usr.bin/diff3/diff3.c
> > @@ -947,6 +947,7 @@ wait_and_check(int pd)
> >  		if (errno != EINTR)
> >  			err(2, "pdwait");
> >  	}
> > +	close(pd);
> >  
> >  	if (WIFEXITED(status) && WEXITSTATUS(status) >= 2)
> >  		errx(2, "diff exited abnormally");
> 
> Well, I pointed out something different.  I think that pipes filedescriptors
> leak to children.

Oh I see you, then I guess this should cover it:
https://reviews.freebsd.org/D56120

Best regards,
Bapt