[sane-devel] signal handling by libsane and backends
Wittawat Yamwong
wy-sane-devel at arcor.de
Fri Sep 15 09:35:00 UTC 2006
On Friday 15 September 2006 08:39, Gerhard Jaeger wrote:
> [...]
> So the point to fix are inside the backends. If someone could
> provide a testcase, this could be easily fixed.
An example for SIGCHLD (as mentioned by Ryan):
------------- Main program ----------------
int main(int argc, char **argv)
{
void *so;
void (*foo)();
so = dlopen("./test1.so", RTLD_LAZY);
foo = dlsym(so, "foo");
foo();
/* I don't need the library anymore. So I unload it. */
dlclose(so);
system("echo hello");
/* SIGSEGV here. */
return 0;
}
------------- test1.so -----------------
static void sighandler(int sig)
{
}
void foo(void)
{
struct sigaction sa;
memset(&sa, 0, sizeof(sa));
sigemptyset(&sa.sa_mask);
sa.sa_handler = sighandler;
sigaction(SIGCHLD, &sa, NULL);
/* forget to restore SIGCHLD handler. */
}
----------------------------------------
"grep -l SIGCHLD *.c" in the backend directory gives:
artec_eplus48u.c
mustek.c
plustek.c
plustek_pp.c
u12.c
Regards
--
Wittawat Yamwong
Hannover, Germany
More information about the sane-devel
mailing list