From ca7549b203e07bb32915f57bef2d3a4ef573be96 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 9 Oct 2002 06:12:54 +0000 Subject: [PATCH] * gc.c (gc_sweep): also adjust heaps_limits when free unused heap page. [ruby-core:00526] * io.c (io_fflush): condition to retry can occur. * io.c (io_write): returned 0 wrongly if no error occurred. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2947 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 9 +++++++++ gc.c | 1 + io.c | 27 +++++++++++++++++++-------- version.h | 4 ++-- 4 files changed, 31 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index a999037a96ecd9..ce71a69c86d865 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Wed Oct 9 07:11:25 2002 Nobuyoshi Nakada + + * gc.c (gc_sweep): also adjust heaps_limits when free unused heap + page. [ruby-core:00526] + + * io.c (io_fflush): condition to retry can occur. + + * io.c (io_write): returned 0 wrongly if no error occurred. + Tue Oct 8 14:19:07 2002 Nobuyoshi Nakada * io.c (io_write): must check returned value from fwrite() before diff --git a/gc.c b/gc.c index 7d461105436f68..94468fe5f9f812 100644 --- a/gc.c +++ b/gc.c @@ -946,6 +946,7 @@ gc_sweep() else { if (i != j) { heaps[j] = heaps[i]; + heaps_limits[j] = heaps_limits[i]; } j++; } diff --git a/io.c b/io.c index 025e73d32184ae..fc50ba869682bd 100644 --- a/io.c +++ b/io.c @@ -277,10 +277,14 @@ io_fflush(f, fptr) int n; rb_thread_fd_writable(fileno(f)); - TRAP_BEG; - n = fflush(f); - TRAP_END; - if (n == EOF) rb_sys_fail(fptr->path); + for (;;) { + TRAP_BEG; + n = fflush(f); + TRAP_END; + if (n != EOF) break; + if (!rb_io_wait_writable(fileno(f))) + rb_sys_fail(fptr->path); + } fptr->mode &= ~FMODE_WBUF; } @@ -374,7 +378,7 @@ io_write(io, str) } } while (--n > 0); #else - for (; (r = fwrite(ptr, 1, n, f)) < n; ptr += r, n -= r) { + while (ptr += (r = fwrite(ptr, 1, n, f)), (n -= r) > 0) { if (ferror(f)) { if (rb_io_wait_writable(fileno(f))) { clearerr(f); @@ -1277,13 +1281,20 @@ fptr_finalize(fptr, fin) if (fptr->f2) { f2 = fileno(fptr->f2); - n2 = fclose(fptr->f2); + while ((n2 = fclose(fptr->f2)) < 0) { + if (!rb_io_wait_writable(f2)) { + e = errno; + break; + } + } fptr->f2 = 0; - if (n2 < 0) e = errno; } if (fptr->f) { f1 = fileno(fptr->f); - n1 = fclose(fptr->f); + while ((n1 = fclose(fptr->f)) < 0) { + if (f2 != -1 || !(fptr->mode & FMODE_WBUF)) break; + if (!rb_io_wait_writable(f1)) break; + } fptr->f = 0; if (n1 < 0 && errno == EBADF) { if (f1 == f2 || !(fptr->mode & FMODE_WBUF)) { diff --git a/version.h b/version.h index 7ec04b3491e86f..e4568d5c39d6f7 100644 --- a/version.h +++ b/version.h @@ -1,4 +1,4 @@ #define RUBY_VERSION "1.7.3" -#define RUBY_RELEASE_DATE "2002-10-08" +#define RUBY_RELEASE_DATE "2002-10-09" #define RUBY_VERSION_CODE 173 -#define RUBY_RELEASE_CODE 20021008 +#define RUBY_RELEASE_CODE 20021009