diff options
-rw-r--r-- | ext/kgio/read_write.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ext/kgio/read_write.c b/ext/kgio/read_write.c index f43942e..26ef779 100644 --- a/ext/kgio/read_write.c +++ b/ext/kgio/read_write.c @@ -76,8 +76,10 @@ static void prepare_read(struct io_args *a, int argc, VALUE *argv, VALUE io) static int read_check(struct io_args *a, long n, const char *msg, int io_wait) { if (n == -1) { - if (errno == EINTR) + if (errno == EINTR) { + a->fd = my_fileno(a->io); return -1; + } rb_str_set_len(a->buf, 0); if (errno == EAGAIN) { if (io_wait) { @@ -307,8 +309,10 @@ static int write_check(struct io_args *a, long n, const char *msg, int io_wait) done: a->buf = Qnil; } else if (n == -1) { - if (errno == EINTR) + if (errno == EINTR) { + a->fd = my_fileno(a->io); return -1; + } if (errno == EAGAIN) { long written = RSTRING_LEN(a->buf) - a->len; |