Bug #13856 » 0001-io.c-fix-segfault-with-closing-socket-on-MinGW.patch
| io.c | ||
|---|---|---|
|
static void clear_codeconv(rb_io_t *fptr);
|
||
|
static void
|
||
|
fptr_finalize_flush(rb_io_t *fptr, int noraise)
|
||
|
fptr_finalize_flush(rb_io_t *fptr, int noraise, int keepgvl)
|
||
|
{
|
||
|
VALUE err = Qnil;
|
||
|
int fd = fptr->fd;
|
||
| ... | ... | |
|
* We assumes it is closed. */
|
||
|
/**/
|
||
|
int keepgvl = !(mode & FMODE_WRITABLE);
|
||
|
keepgvl |= !(mode & FMODE_WRITABLE);
|
||
|
keepgvl |= noraise;
|
||
|
if ((maygvl_close(fd, keepgvl) < 0) && NIL_P(err))
|
||
|
err = noraise ? Qtrue : INT2NUM(errno);
|
||
| ... | ... | |
|
static void
|
||
|
fptr_finalize(rb_io_t *fptr, int noraise)
|
||
|
{
|
||
|
fptr_finalize_flush(fptr, noraise);
|
||
|
fptr_finalize_flush(fptr, noraise, FALSE);
|
||
|
free_io_buffer(&fptr->rbuf);
|
||
|
free_io_buffer(&fptr->wbuf);
|
||
|
clear_codeconv(fptr);
|
||
| ... | ... | |
|
fd = fptr->fd;
|
||
|
busy = rb_notify_fd_close(fd);
|
||
|
fptr_finalize_flush(fptr, FALSE);
|
||
|
if (busy) {
|
||
|
fptr_finalize_flush(fptr, FALSE, TRUE);
|
||
|
do rb_thread_schedule(); while (rb_notify_fd_close(fd));
|
||
|
}
|
||
|
rb_io_fptr_cleanup(fptr, FALSE);
|
||
- « Previous
- 1
- 2
- Next »