aboutsummaryrefslogtreecommitdiffstats
path: root/etc.c
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2003-01-23 15:59:24 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2003-01-23 15:59:24 +0000
commitfb759b572b8e6303d84233a95bf87ae748545bfb (patch)
tree4bd477f638f87a2adcb3f99625cc0673ab108c78 /etc.c
parent[w3m-dev 03678] Re: config.param is clear when configure -help (diff)
downloadw3m-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 'etc.c')
-rw-r--r--etc.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/etc.c b/etc.c
index 2dca5c9..37cb19d 100644
--- a/etc.c
+++ b/etc.c
@@ -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;