Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
node: don't check return value of unsetenv()
It returns void on some platforms, notably FreeBSD.
  • Loading branch information
bnoordhuis committed Apr 16, 2012
1 parent d03b80b commit 3f42612
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/node.cc
Expand Up @@ -1880,12 +1880,9 @@ static Handle<Boolean> EnvDeleter(Local<String> property,
HandleScope scope;
#ifdef __POSIX__
String::Utf8Value key(property);
// prototyped as `void unsetenv(const char*)` on some platforms
if (unsetenv(*key) < 0) {
// Deletion failed. Return true if the key wasn't there in the first place,
// false if it is still there.
return scope.Close(Boolean::New(getenv(*key) == NULL));
};
if (!getenv(*key)) return False();
unsetenv(*key); // can't check return value, it's void on some platforms
return True();
#else
String::Value key(property);
WCHAR* key_ptr = reinterpret_cast<WCHAR*>(*key);
Expand All @@ -1896,9 +1893,8 @@ static Handle<Boolean> EnvDeleter(Local<String> property,
GetLastError() != ERROR_SUCCESS;
return scope.Close(Boolean::New(rv));
}
return True();
#endif
// It worked
return v8::True();
}


Expand Down

0 comments on commit 3f42612

Please sign in to comment.