From aec80d47bb5e17890b41a4b0fc1e95c844aca2eb Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Wed, 31 Mar 2010 08:20:59 -0700 Subject: [PATCH] Better check for FDs in net2 bindings --- src/node_net2.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/node_net2.cc b/src/node_net2.cc index 90b58135f9f..5e868f68e64 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) {