mirror of https://github.com/nodejs/node.git
node: don't check return value of unsetenv()
It returns void on some platforms, notably FreeBSD.pull/24503/head
parent
d03b80bc12
commit
3f4261276e
12
src/node.cc
12
src/node.cc
|
@ -1880,12 +1880,9 @@ static Handle<Boolean> EnvDeleter(Local<String> property,
|
||||||
HandleScope scope;
|
HandleScope scope;
|
||||||
#ifdef __POSIX__
|
#ifdef __POSIX__
|
||||||
String::Utf8Value key(property);
|
String::Utf8Value key(property);
|
||||||
// prototyped as `void unsetenv(const char*)` on some platforms
|
if (!getenv(*key)) return False();
|
||||||
if (unsetenv(*key) < 0) {
|
unsetenv(*key); // can't check return value, it's void on some platforms
|
||||||
// Deletion failed. Return true if the key wasn't there in the first place,
|
return True();
|
||||||
// false if it is still there.
|
|
||||||
return scope.Close(Boolean::New(getenv(*key) == NULL));
|
|
||||||
};
|
|
||||||
#else
|
#else
|
||||||
String::Value key(property);
|
String::Value key(property);
|
||||||
WCHAR* key_ptr = reinterpret_cast<WCHAR*>(*key);
|
WCHAR* key_ptr = reinterpret_cast<WCHAR*>(*key);
|
||||||
|
@ -1896,9 +1893,8 @@ static Handle<Boolean> EnvDeleter(Local<String> property,
|
||||||
GetLastError() != ERROR_SUCCESS;
|
GetLastError() != ERROR_SUCCESS;
|
||||||
return scope.Close(Boolean::New(rv));
|
return scope.Close(Boolean::New(rv));
|
||||||
}
|
}
|
||||||
|
return True();
|
||||||
#endif
|
#endif
|
||||||
// It worked
|
|
||||||
return v8::True();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue