summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-11-26 08:25:51 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-11-26 08:25:51 +0000
commit11187ce939d94c3a2f6d9239114c2696a8271834 (patch)
treecfa74a6ea96d9652aae8da349eec2da41b2aca64 /io.c
parent8271cacad706ed0d7741889faebb0c19270b8370 (diff)
1.1c9 - 1.1c final, hopefully
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/io.c b/io.c
index 34f0ec3a95..fd74c450e2 100644
--- a/io.c
+++ b/io.c
@@ -370,7 +370,6 @@ read_all(port)
GetOpenFile(port, fptr);
io_readable(fptr);
- str = str_new(0, siz);
if (fstat(fileno(fptr->f), &st) == 0 && S_ISREG(st.st_mode)
#ifdef __BEOS__
&& (st.st_dev > 3)
@@ -385,6 +384,7 @@ read_all(port)
}
}
}
+ str = str_new(0, siz);
for (;;) {
READ_CHECK(fptr->f);
TRAP_BEG;
@@ -2455,12 +2455,12 @@ arg_read(argc, argv)
retry:
if (!next_argv()) return str;
tmp = io_read(argc, argv, file);
- if (NIL_P(tmp) && next_p != -1) {
+ if ((NIL_P(tmp) || RSTRING(tmp)->len == 0) && next_p != -1) {
io_close(file);
next_p = 1;
goto retry;
}
- if (NIL_P(tmp)) return str;
+ if (NIL_P(tmp) || RSTRING(tmp)->len == 0) return str;
else if (NIL_P(str)) str = tmp;
else str_cat(str, RSTRING(tmp)->ptr, RSTRING(tmp)->len);
if (argc == 0) {