summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authornagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-11-03 08:14:25 +0000
committernagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-11-03 08:14:25 +0000
commitff861c0c7d88c7e5cf5fc4c4c1bceadb3bd0622b (patch)
tree7f48579e5d61f751d1dc71ed3014998a42221c95 /io.c
parent8ff005361ac5362fbc70573cae78b21fed308f4e (diff)
* io.c (pipe_open): fix compile error
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/io.c b/io.c
index 7f104f1..c1e68fb 100644
--- a/io.c
+++ b/io.c
@@ -2592,9 +2592,11 @@ pipe_open(pstr, pname, mode)
int modef = rb_io_mode_flags(mode);
OpenFile *fptr;
- if (!pname) pname = StringValuePtr(pstr);
#if defined(DJGPP) || defined(__human68k__) || defined(__VMS)
- FILE *f = popen(pname, mode);
+ FILE *f;
+
+ if (!pname) pname = StringValuePtr(pstr);
+ f = popen(pname, mode);
if (!f) rb_sys_fail(pname);
else {
@@ -2618,6 +2620,8 @@ pipe_open(pstr, pname, mode)
int pid;
FILE *fpr, *fpw;
+ if (!pname) pname = StringValuePtr(pstr);
+
retry:
pid = pipe_exec(pname, rb_io_mode_modenum(mode), &fpr, &fpw);
if (pid == -1) { /* exec failed */
@@ -2650,6 +2654,8 @@ retry:
int pid, pr[2], pw[2];
volatile int doexec;
+ if (!pname) pname = StringValuePtr(pstr);
+
if (((modef & FMODE_READABLE) && pipe(pr) == -1) ||
((modef & FMODE_WRITABLE) && pipe(pw) == -1))
rb_sys_fail(pname);