diff --git a/src/node_os.cc b/src/node_os.cc index d9712b8bf4..3047d0744d 100644 --- a/src/node_os.cc +++ b/src/node_os.cc @@ -69,14 +69,11 @@ static Handle GetOSType(const Arguments& args) { HandleScope scope; #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