aboutsummaryrefslogtreecommitdiff
path: root/src/stream_wrap.cc
diff options
context:
space:
mode:
authorKarl Skomski <karl@skomski.com>2012-06-15 23:21:36 +0200
committerisaacs <i@izs.me>2012-06-16 09:00:20 -0700
commit8d5c1201f24a6102d047bd7ec70f30da70a5ea64 (patch)
tree4af18935d3956f3054886cd7f79eb16027eab14a /src/stream_wrap.cc
parentbdd57f075631381e5ccff74dd78055f206b65f4d (diff)
downloadandroid-node-v8-8d5c1201f24a6102d047bd7ec70f30da70a5ea64.tar.gz
android-node-v8-8d5c1201f24a6102d047bd7ec70f30da70a5ea64.tar.bz2
android-node-v8-8d5c1201f24a6102d047bd7ec70f30da70a5ea64.zip
Check if a stream has a valid fd before read_start
Closes #3118
Diffstat (limited to 'src/stream_wrap.cc')
-rw-r--r--src/stream_wrap.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/stream_wrap.cc b/src/stream_wrap.cc
index e79d212c43..768d95214a 100644
--- a/src/stream_wrap.cc
+++ b/src/stream_wrap.cc
@@ -132,6 +132,10 @@ Handle<Value> StreamWrap::ReadStart(const Arguments& args) {
UNWRAP(StreamWrap)
+ // Probably the user did .pause() and then an immediate .resume()
+ // before the fd had been set up. Don't even try to set up.
+ if (wrap->stream_->fd < 0) return scope.Close(Integer::New(1));
+
bool ipc_pipe = wrap->stream_->type == UV_NAMED_PIPE &&
((uv_pipe_t*)wrap->stream_)->ipc;
int r;