diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-04-10 07:04:41 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-04-10 07:04:41 +0000 |
commit | 983e8ff915118d00b683109df0834733b485086d (patch) | |
tree | 499e228b999c1e44b1142f0fa5ba38c62b7c9453 | |
parent | 01949865e2715b487e098dbc60ba3ae7a01a3b54 (diff) | |
download | kgio-983e8ff915118d00b683109df0834733b485086d.tar.gz |
Another thread may have killed the descriptor.
-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; |