summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2019-08-21 11:18:00 +1000
committerSteve Bennett <steveb@workware.net.au>2019-09-06 20:08:31 +1000
commit4dc539a582764fc4ae6788fc3f1dc0e6e7cd95d4 (patch)
treec915f71250a4dd85dd00dea8fe32cbdbbbe5eade
parent4fd87e892eeb9bcb050e3f5bc3b5b5f92dc0f6aa (diff)
exec: Don't force SIGPIPE to be enabled
Previously SIGPIPE was set to SIG_DFL before vfork so that child processes always had SIGPIPE enabled. This makes it impossible to disable SIGPIPE for child processes. So don't do this. Instead allow the disposition of SIGPIPE to be handled by the 'signal' command. Signed-off-by: Steve Bennett <steveb@workware.net.au>
-rw-r--r--jim-exec.c17
1 files changed, 0 insertions, 17 deletions
diff --git a/jim-exec.c b/jim-exec.c
index 005b28b..67d2f18 100644
--- a/jim-exec.c
+++ b/jim-exec.c
@@ -1079,9 +1079,6 @@ badargs:
close(lastOutputId);
}
- /* Restore SIGPIPE behaviour */
- (void)signal(SIGPIPE, SIG_DFL);
-
execvpe(arg_array[firstArg], &arg_array[firstArg], child_environ);
if (write(fileno(stderr), "couldn't exec \"", 15) &&
@@ -1239,20 +1236,6 @@ int Jim_execInit(Jim_Interp *interp)
if (Jim_PackageProvide(interp, "exec", "1.0", JIM_ERRMSG))
return JIM_ERR;
-#ifdef SIGPIPE
- /*
- * Disable SIGPIPE signals: if they were allowed, this process
- * might go away unexpectedly if children misbehave. This code
- * can potentially interfere with other application code that
- * expects to handle SIGPIPEs.
- *
- * By doing this in the init function, applications can override
- * this later. Note that child processes have SIGPIPE restored
- * to the default after vfork().
- */
- (void)signal(SIGPIPE, SIG_IGN);
-#endif
-
waitinfo = JimAllocWaitInfoTable();
Jim_CreateCommand(interp, "exec", Jim_ExecCmd, waitinfo, JimFreeWaitInfoTable);
waitinfo->refcount++;