diff --git a/src/node_net2.cc b/src/node_net2.cc index 90b58135f9..5e868f68e6 100644 --- a/src/node_net2.cc +++ b/src/node_net2.cc @@ -50,11 +50,11 @@ static Persistent recv_msg_template; #define FD_ARG(a) \ - if (!(a)->IsInt32()) { \ + int fd; \ + if (!(a)->IsInt32() || (fd = (a)->Int32Value()) < 0) { \ return ThrowException(Exception::TypeError( \ String::New("Bad file descriptor argument"))); \ - } \ - int fd = (a)->Int32Value(); + } static inline const char *errno_string(int errorno) {