From 11187ce939d94c3a2f6d9239114c2696a8271834 Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 26 Nov 1998 08:25:51 +0000 Subject: 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 --- io.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'io.c') 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) { -- cgit v1.2.3