Source: sane
Version: 1.0.14-9
Severity: normal
Tags: patch

According to POSIX, “If the SIGCHLD signal is set to be ignored by the calling process image, it is unspecified whether [after an exec*() call] the SIGCHLD signal is set to be ignored or to the default action in the new process image.”[0]

scanadf sets SIGCHLD to SIG_IGN just before calling fork() and execle(). This action will be inherited by child processes on Linux and Hurd systems (though, apparently, not on kFreeBSD). This is certainly undesired behaviour, and breaks every program that expect this signal action to be set reasonably at startup (e.g. Python programs using the subprocess module).

The attached (untested) patch should fix this bug.

[0] http://www.opengroup.org/onlinepubs/009695399/functions/exec.html

--
Jakub Wilk
diff --git a/src/scanadf.c b/src/scanadf.c
--- a/src/scanadf.c
+++ b/src/scanadf.c
@@ -1195,6 +1195,7 @@
 
 	case 0:
 	  /*  in child process  */
+	  signal(SIGCHLD, SIG_DFL);
 	  sprintf(cmd, "%s '%s'", script, fname);
 	  /*	  system(cmd); */
 	  execle(script, script, fname, NULL, environ);

Attachment: signature.asc
Description: Digital signature

Reply via email to