Merge remote-tracking branch 'origin/v0.10'
authorBen Noordhuis <info@bnoordhuis.nl>
Thu, 18 Apr 2013 10:14:30 +0000 (12:14 +0200)
committerBen Noordhuis <info@bnoordhuis.nl>
Thu, 18 Apr 2013 10:14:30 +0000 (12:14 +0200)
Conflicts:
src/node_os.cc

1  2 
src/handle_wrap.cc
src/node_crypto.cc
src/node_os.cc

Simple merge
@@@ -1983,10 -1959,11 +1983,11 @@@ Handle<Value> Connection::GetNegotiated
      SSL_get0_next_proto_negotiated(ss->ssl_, &npn_proto, &npn_proto_len);
  
      if (!npn_proto) {
 -      return False();
 +      return False(node_isolate);
      }
  
-     return String::New((const char*) npn_proto, npn_proto_len);
+     return scope.Close(String::New(reinterpret_cast<const char*>(npn_proto),
+                                    npn_proto_len));
    } else {
      return ss->selectedNPNProto_;
    }
diff --cc src/node_os.cc
@@@ -50,11 -57,10 +57,10 @@@ static Handle<Value> GetEndianness(cons
  }
  
  static Handle<Value> GetHostname(const Arguments& args) {
 -  HandleScope scope;
 +  HandleScope scope(node_isolate);
-   char s[255];
-   int r = gethostname(s, 255);
+   char buf[MAXHOSTNAMELEN + 1];
  
-   if (r < 0) {
+   if (gethostname(buf, sizeof(buf))) {
  #ifdef __POSIX__
      return ThrowException(ErrnoException(errno, "gethostname"));
  #else // __MINGW32__
  }
  
  static Handle<Value> GetOSType(const Arguments& args) {
 -  HandleScope scope;
 +  HandleScope scope(node_isolate);
  
  #ifdef __POSIX__
-   char type[256];
    struct utsname info;
-   uname(&info);
-   strncpy(type, info.sysname, strlen(info.sysname));
-   type[strlen(info.sysname)] = 0;
-   return scope.Close(String::New(type));
+   if (uname(&info)) {
+     return ThrowException(ErrnoException(errno, "uname"));
+   }
+   return scope.Close(String::New(info.sysname));
  #else // __MINGW32__
    return scope.Close(String::New("Windows_NT"));
  #endif