diff options
Diffstat (limited to '')
-rw-r--r-- | etc.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -1,4 +1,4 @@ -/* $Id: etc.c,v 1.54 2003/01/22 16:11:03 ukai Exp $ */ +/* $Id: etc.c,v 1.55 2003/01/23 15:59:25 ukai Exp $ */ #include "fm.h" #include <pwd.h> #include "myctype.h" @@ -1369,11 +1369,17 @@ open_pipe_rw(FILE ** fr, FILE ** fw) else { if (fr) { close(fdr[1]); - *fr = fdopen(fdr[0], "r"); + if (*fr == stdin) + dup2(fdr[0], 0); + else + *fr = fdopen(fdr[0], "r"); } if (fw) { close(fdw[0]); - *fw = fdopen(fdw[1], "w"); + if (*fw == stdout) + dup2(fdw[1], 1); + else + *fw = fdopen(fdw[1], "w"); } } return pid; |