[sane-devel] signal handling by libsane and backends

Gerhard Jaeger gerhard at gjaeger.de
Fri Sep 15 06:39:47 UTC 2006


On Thursday 14 September 2006 13:30, Wittawat Yamwong wrote:
> Hi,
> 
> On Thursday 14 September 2006 09:09, Gerhard Jaeger wrote:
> > On Tuesday 12 September 2006 04:02, Ryan Reading wrote:
> > > The sane library and/or its backends don't seem to "clean up" after
> > > themselves by restoring signal handlers and/or signal masks.
> > > [...] 
> >
> > And yes, I think you are right. Grep for sigaction or signal function calls
> > within the backend directory and you'll see, that no backend saves the
> > old sigmasks or handlers for restoring.
> 
> I think, it is OK if the backend modifies sigmasks and/or installs signal 
> handlers in the _child_ process but doesn't restore them. On the other hand, 
> as Ryan mentioned, it will probably cause problems if you do it in the parent 
> process and do not take special care of old sigmasks and signal handlers.
> 
> > Even sanei_thread does not restore the tweaked masks/handlers.
> > Workaround could be to get the settings before calling any sane function
> > and to do the restore stuff on your own.
> 
> This should be documented somewhere, maybe in PROBLEMS?

Nope, I think it should be fixed...
I digged a little deeper to sanei_thread and the only points, where
we fiddle with signals is
SIGPIPE and
SIGUSR2 (only for __APPLE__ && __MACH__)

SIGPIPE will be restored
SIGUSR2 not, which is IMHO not critical

So the point to fix are inside the backends. If someone could
provide a testcase, this could be easily fixed.

Gerhard





More information about the sane-devel mailing list