[LTP] [PATCH] pty/pty07: Restore active console after the testrun

Cyril Hrubis chrubis@suse.cz
Fri Mar 11 11:06:25 CET 2022


Hi!
> >  static void cleanup(void)
> >  {
> > -	tst_fzsync_pair_cleanup(&fzp);
> > -	if (fd >= 0)
> > +	if (fd >= 0) {
> > +		tst_res(TINFO, "Restoring active console");
> > +		SAFE_IOCTL(fd, VT_ACTIVATE, vt_active);
> >  		SAFE_CLOSE(fd);
> > +	}
> > +
> > +	tst_fzsync_pair_cleanup(&fzp);
> 
> If you move the fzsync cleanup to the end of cleanup(), you can end up
> with the open_close() thread racing against fd cleanup.

Ah, right, looking closely at the fzsync, the thread B may be racing
against the restoration in the case that something caused premature exit
in the thread A.

Will move the call back to the start of the cleanup().

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list