From a9bb83e2d9bf42ad60d81acdbf7cc39c9d68e2f7 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Mon, 11 Jul 2011 04:16:03 +0200 Subject: execute EC commands with /bin/sh * makes special handling of Linux unnecessary * enables the (undocumented) :EC mode where the entire buffer content is written to the process (two pipes are created, both stdin and stdout/stderr are redirected) on Linux --- teccmd.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/teccmd.c b/teccmd.c index b390550..b641707 100644 --- a/teccmd.c +++ b/teccmd.c @@ -1766,31 +1766,19 @@ int buf_pipe[2]; /* * Fork to get a process to run the shell */ -#ifdef LINUX - if((pid = fork()) == 0){ - close(1); dup(pipe_desc[1]); - close(2); dup(pipe_desc[1]); - close(pipe_desc[0]); - close(pipe_desc[1]); - execl("/bin/bash","bash","-c",cp,NULL); - _exit(127); - }/* End IF */ -#else if((pid = fork()) == 0){ if (pipe_buf_flag) { close(0); dup(buf_pipe[0]); + close(buf_pipe[0]); close(buf_pipe[1]); - } else { - close(pipe_desc[0]); } close(1); dup(pipe_desc[1]); close(2); dup(pipe_desc[1]); close(pipe_desc[0]); close(pipe_desc[1]); - execl("/bin/csh","csh","-cf",cp,0,NULL); + execl("/bin/sh","sh","-c",cp,NULL); _exit(127); }/* End IF */ -#endif if(pid == -1){ close(pipe_desc[0]); close(pipe_desc[1]); -- cgit v1.2.3