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

Richard Palethorpe rpalethorpe@suse.de
Tue Mar 22 09:13:26 CET 2022


Hello,

Cyril Hrubis <chrubis@suse.cz> writes:

> 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

Why are we using /dev/tty8 instead of allocating a pty with /dev/ptmx?

-- 
Thank you,
Richard.


More information about the ltp mailing list