diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2003-01-23 15:59:24 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2003-01-23 15:59:24 +0000 |
commit | fb759b572b8e6303d84233a95bf87ae748545bfb (patch) | |
tree | 4bd477f638f87a2adcb3f99625cc0673ab108c78 /etc.c | |
parent | [w3m-dev 03678] Re: config.param is clear when configure -help (diff) | |
download | w3m-fb759b572b8e6303d84233a95bf87ae748545bfb.tar.gz w3m-fb759b572b8e6303d84233a95bf87ae748545bfb.zip |
[w3m-dev 03679] Re: cleanup for pipe
* etc.c (open_pipe_rw): check stdin, stdout
* file.c (uncompress_stream): rewrite
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
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; |