[PATCH] ash: clear NONBLOCK flag from stdin when in foreground

Bernd Petrovitsch bernd at petrovitsch.priv.at
Fri Aug 19 23:26:44 UTC 2011


On Fre, 2011-08-19 at 16:50 -0400, Rich Felker wrote:
> On Fri, Aug 19, 2011 at 05:17:52PM +0200, Harald Becker wrote:
> >  Hallo Rich!
> > 
> > > sigfillset(&set);
> > > sigprocmask(SIG_BLOCK, &set, 0);
> > > sigemptyset(&set);
> > > sigaddset(&set, SIGTERM); /* and any others I want to handle */
> > > sigprocmask(SIG_UNBLOCK, &set, 0);
> > >
> > > This is a lot more robust.

Depends IMHO on what one wants to achieve. Usually I just want to ignore
SIGPIPE and leave the rest as is (and whatever it is).

> > Robust yes ... such robust that it disables also fatal signals which may
> > lead to disastrous results, as such situations will no more terminate
> > the process and may continue running into possibly indeterminable
> > states!! ... think of illegal instruction traps and others.
> 
> Illegal instruction trap cannot happen unless you've written nonsense
> code that clobbers function pointers or such, in which case whatever

... or that a/the compiler is buggy or that some bits in memory flip
somewhere or ....
Granted, that happens seldom. But it happens in the field.

[...]

	Bernd
-- 
Bernd Petrovitsch                  Email : bernd at petrovitsch.priv.at
                     LUGA : http://www.luga.at



More information about the busybox mailing list