Subject: Re: O_ASYNC on ttys
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: Jaromír <jdolecek@netbsd.org>
List: tech-kern
Date: 07/07/2001 16:30:09
der Mouse wrote:
> I couldn't see any harm in permitting TIOCSPGRP on ttys that aren't
> your control tty, provided they aren't anyone else's either, so I
> simply disabled the control-tty test for ttys that don't belong to a
> session:

This looks okay. Does revoke(2) check (and remove) the O_ASYNC flag?

Jaromir
 
> diff -c -r src/sys/kern/tty.c src+/sys/kern/tty.c
> *** src/sys/kern/tty.c	Sat Jul  7 03:18:52 2001
> --- src+/sys/kern/tty.c	Sat Jul  7 05:19:09 2001
> ***************
> *** 0 ****
> --- 1,11 ----
> + --- OLD/sys/kern/tty.c	Thu Jan  1 00:00:00 1970
> + +++ NEW/sys/kern/tty.c	Thu Jan  1 00:00:00 1970
> + @@ -987,7 +987,7 @@
> +  	case TIOCSPGRP: {		/* set pgrp of tty */
> +  		register struct pgrp *pgrp = pgfind(*(int *)data);
> +  
> + -		if (!isctty(p, tp))
> + +		if (tp->t_session && !isctty(p, tp))
> +  			return (ENOTTY);
> +  		else if (pgrp == NULL)
> +  			return (EINVAL);
> 
> Now, something equivalent may have already been done; I don't have a
> -current machine set up.  But if not, well, if I've missed something,
> I'd appreciate someone indicating what; if not, I offer this for
> consideration.
> 
> /~\ The ASCII				der Mouse
> \ / Ribbon Campaign
>  X  Against HTML	       mouse@rodents.montreal.qc.ca
> / \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B
> 


-- 
Jaromir Dolecek <jdolecek@NetBSD.org>      http://www.ics.muni.cz/~dolecek/
NetBSD - just plain best OS! -=*=- Got spare MCA cards or docs? Hand me them!