From 4dc539a582764fc4ae6788fc3f1dc0e6e7cd95d4 Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Wed, 21 Aug 2019 11:18:00 +1000 Subject: [PATCH] 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 --- jim-exec.c | 17 ----------------- 1 file changed, 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++; -- 2.11.4.GIT