Skip to content

Commit

Permalink
* gc.c (gc_sweep): also adjust heaps_limits when free unused heap
Browse files Browse the repository at this point in the history
  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
  • Loading branch information
nobu committed Oct 9, 2002
1 parent 2ececa4 commit ca7549b
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 10 deletions.
9 changes: 9 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
Wed Oct 9 07:11:25 2002 Nobuyoshi Nakada <[email protected]>

* 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 <[email protected]>

* io.c (io_write): must check returned value from fwrite() before
Expand Down
1 change: 1 addition & 0 deletions gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,7 @@ gc_sweep()
else {
if (i != j) {
heaps[j] = heaps[i];
heaps_limits[j] = heaps_limits[i];
}
j++;
}
Expand Down
27 changes: 19 additions & 8 deletions io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)) {
Expand Down
4 changes: 2 additions & 2 deletions version.h
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit ca7549b

Please sign in to comment.