#ifdef __POSIX__
struct utsname info;
- if (uname(&info)) {
+ if (uname(&info) < 0) {
return ThrowException(ErrnoException(errno, "uname"));
}
return scope.Close(String::New(info.sysname));
static Handle<Value> GetOSRelease(const Arguments& args) {
HandleScope scope;
- char release[256];
#ifdef __POSIX__
struct utsname info;
-
- uname(&info);
- strncpy(release, info.release, strlen(info.release));
- release[strlen(info.release)] = 0;
-
+ if (uname(&info) < 0) {
+ return ThrowException(ErrnoException(errno, "uname"));
+ }
+ return scope.Close(String::New(info.release));
#else // __MINGW32__
+ char release[256];
OSVERSIONINFO info;
info.dwOSVersionInfoSize = sizeof(info);
sprintf(release, "%d.%d.%d", static_cast<int>(info.dwMajorVersion),
static_cast<int>(info.dwMinorVersion), static_cast<int>(info.dwBuildNumber));
+ return scope.Close(String::New(release));
#endif
- return scope.Close(String::New(release));
}
static Handle<Value> GetCPUInfo(const Arguments& args) {