[LTP] [PATCH] open04: add EMFILE check

Cyril Hrubis chrubis@suse.cz
Thu Sep 15 16:21:26 CEST 2022


Hi!
> > diff --git a/testcases/kernel/syscalls/open/open04.c b/testcases/kernel/syscalls/open/open04.c
> > index d452405d4..01a8b12d6 100644
> > --- a/testcases/kernel/syscalls/open/open04.c
> > +++ b/testcases/kernel/syscalls/open/open04.c
> > @@ -33,7 +33,12 @@ static void setup(void)
> 
> >  	for (i = first + 1; i < fds_limit; i++) {
> >  		sprintf(fname, FNAME ".%d", i);
> > -		fd = SAFE_OPEN(fname, O_RDWR | O_CREAT, 0777);
> > +		fd = open(fname, O_RDWR | O_CREAT, 0777);
> > +		if (fd == -1) {
> > +			if (errno != EMFILE)
> > +				tst_brk(TBROK, "Expected EMFILE but got %d", errno);
> > +			break;
> > +		}
> >  		fds[i - first] = fd;
> >  	}
> >  }
> 
> LGTM.
> Reviewed-by: Petr Vorel <pvorel@suse.cz>

I faintly remmeber a similar patch where we decided not to work around
for a test harness leaking filedescriptors into testcases.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list