Skip to content

Instantly share code, notes, and snippets.

@Mon-Ouie
Created January 24, 2010 20:07
Show Gist options
  • Save Mon-Ouie/285418 to your computer and use it in GitHub Desktop.
Save Mon-Ouie/285418 to your computer and use it in GitHub Desktop.
static void
io_fflush(f, fptr)
FILE *f;
OpenFile *fptr;
{
int n;
if (!rb_thread_fd_writable(fileno(f))) {
rb_io_check_closed(fptr);
}
for (;;) {
TRAP_BEG;
n = fflush(f);
TRAP_END;
if (n != EOF) break;
if (!rb_io_wait_writable(fileno(f)))
rb_sys_fail(fptr->path); /* this line is executed */
}
fptr->mode &= ~FMODE_WBUF;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment