[igt-dev] [PATCH i-g-t 1/2] runner/resultgen: Remember to close fd to aborted.txt

Petri Latvala petri.latvala at intel.com
Wed Jul 29 12:21:55 UTC 2020


On Wed, Jul 29, 2020 at 01:00:21PM +0100, Chris Wilson wrote:
> Quoting Petri Latvala (2020-07-29 12:34:24)
> > Signed-off-by: Petri Latvala <petri.latvala at intel.com>
> > Cc: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
> > Cc: Lukasz Fiedorowicz <lukasz.fiedorowicz at intel.com>
> > ---
> >  runner/resultgen.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/runner/resultgen.c b/runner/resultgen.c
> > index e2e162b0..3fe83b43 100644
> > --- a/runner/resultgen.c
> > +++ b/runner/resultgen.c
> > @@ -1637,6 +1637,7 @@ struct json_object *generate_results_json(int dirfd)
> >                 add_to_totals("runner", &abortsub, &results);
> >  
> >                 free_subtests(&abortsub);
> > +               close(fd);
> >         }
> >  
> >         free_settings(&settings);
> 
> For completeness, I noticed that generate_results_path() has an open
> within a matching close.

Hmm, well caught!

generate_results_path() calls generate_results() which calls
generate_results_json(), none of which close the passed fd. All those
functions are exported entry points with their own callers here and
there... and from a quick look around, it's expected that the caller
still owns the fd. Without it being commented. Hrmph.

Other callers do close the fd themselves, except for two, igt_results
binary and generate_results_path(). Will fix that in a future patch.


-- 
Petri Latvala


More information about the igt-dev mailing list