summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/io.c b/io.c
index 1e84717562..9bc1c6014f 100644
--- a/io.c
+++ b/io.c
@@ -454,7 +454,9 @@ io_fread(ptr, len, f)
if (!READ_DATA_PENDING(f)) {
rb_thread_wait_fd(fileno(f));
}
+ TRAP_BEG;
c = getc(f);
+ TRAP_END;
if (c == EOF) {
*ptr = '\0';
break;
@@ -1456,7 +1458,8 @@ pipe_open(pname, mode)
pipe_add_fptr(fptr);
if (modef & FMODE_READABLE) fptr->f = f;
if (modef & FMODE_WRITABLE) {
- fptr->f2 = f;
+ if (fptr->f) fptr->f2 = f;
+ else fptr->f = f;
rb_io_synchronized(fptr);
}
return (VALUE)port;