summaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-06-13 09:42:40 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-06-13 09:42:40 +0000
commit87af593ce27b48ca27ee8b5e5278ec2abbad5a5f (patch)
tree6bf09f98a1fdc4f538a37d9d12b7ce602c63b0a6 /io.c
parent00c5f6b1e53ab40c95e5da02ff8bfb9d5631c00a (diff)
downloadruby-87af593ce27b48ca27ee8b5e5278ec2abbad5a5f.tar.gz
ruby-87af593ce27b48ca27ee8b5e5278ec2abbad5a5f.tar.xz
ruby-87af593ce27b48ca27ee8b5e5278ec2abbad5a5f.zip
2000-06-13
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/io.c b/io.c
index 61120908b..f56ed79f7 100644
--- a/io.c
+++ b/io.c
@@ -498,6 +498,10 @@ io_fread(ptr, len, f)
c = getc(f);
TRAP_END;
if (c == EOF) {
+ if (ferror(f)) {
+ if (errno == EINTR) continue;
+ rb_sys_fail(0);
+ }
*ptr = '\0';
break;
}
@@ -624,7 +628,10 @@ rb_io_gets_internal(argc, argv, io)
c = getc(f);
TRAP_END;
if (c == EOF) {
- if (ferror(f) && errno == EINTR) continue;
+ if (ferror(f)) {
+ if (errno == EINTR) continue;
+ rb_sys_fail(fptr->path);
+ }
break;
}
if ((*bp++ = c) == newline) break;
@@ -711,7 +718,10 @@ rb_io_gets(io)
c = getc(f);
TRAP_END;
if (c == EOF) {
- if (ferror(f) && errno == EINTR) continue;
+ if (ferror(f)) {
+ if (errno == EINTR) continue;
+ rb_sys_fail(fptr->path);
+ }
break;
}
if ((*bp++ = c) == '\n') break;
@@ -865,7 +875,13 @@ rb_io_each_byte(io)
TRAP_BEG;
c = getc(f);
TRAP_END;
- if (c == EOF) break;
+ if (c == EOF) {
+ if (ferror(f)) {
+ if (errno == EINTR) continue;
+ rb_sys_fail(fptr->path);
+ }
+ break;
+ }
rb_yield(INT2FIX(c & 0xff));
}
if (ferror(f)) rb_sys_fail(fptr->path);
@@ -884,13 +900,17 @@ rb_io_getc(io)
rb_io_check_readable(fptr);
f = fptr->f;
+ retry:
READ_CHECK(f);
TRAP_BEG;
c = getc(f);
TRAP_END;
if (c == EOF) {
- if (ferror(f)) rb_sys_fail(fptr->path);
+ if (ferror(f)) {
+ if (errno == EINTR) goto retry;
+ rb_sys_fail(fptr->path);
+ }
return Qnil;
}
return INT2FIX(c & 0xff);