Subject: Re: bin/10879: su does not reset terminal settings after Ctrl-C
To: James Chacon <jchacon@genuity.net>
From: Lucio De Re <lucio@proxima.alt.za>
List: netbsd-bugs
Date: 08/24/2000 17:39:19
On Thu, Aug 24, 2000 at 10:58:23AM -0400, James Chacon wrote:
> 
> Ok, it's been a while since I wrote lots of signal code, but how exactly would
> you query the current signal handler without changing it? sigaction/signal
> only return the previous handler after you change it which is definitly not
> what I'd want a library routine doing (race conditions, etc).
> 
If you're willing to change in the first palce, just put it back if it
wasn't what you expected.  From (bad) memory:

	s = signal (SIGINT, SIG_IGN);
	if (s != SIG_DFL)
		signal (SIGINT, s);

This isn't exactly worse than what you'd have done anyway, is it?
There's a very small period during which the ^C may be ignored, but I
really can't imagine it being long enough for anyone to race it, not
even expect :-)

Don't forget to put it back if it stays changed.

I hope I'm not leading you up the garden path.

++L