aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2011-07-11 04:16:03 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2011-07-11 04:16:03 +0200
commita9bb83e2d9bf42ad60d81acdbf7cc39c9d68e2f7 (patch)
tree1b519b43a27f1454e909cdff52112b59b9b0111b
parent2da170b5b26183de570b36fdb7d238431f111f56 (diff)
downloadvideoteco-fork-a9bb83e2d9bf42ad60d81acdbf7cc39c9d68e2f7.tar.gz
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
-rw-r--r--teccmd.c16
1 files 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]);