mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
LibC: setenv don't require 'overwrite' for non-existing value
Instead, require 'overwrite' only for already-existing values. I.e., require 'overwrite' only when overwriting.
This commit is contained in:
parent
3d5abae17b
commit
b4b39258ac
Notes:
sideshowbarker
2024-07-19 04:24:35 +09:00
Author: https://github.com/BenWiederhake Commit: https://github.com/SerenityOS/serenity/commit/b4b39258ac0 Pull-request: https://github.com/SerenityOS/serenity/pull/2940
1 changed files with 1 additions and 1 deletions
|
@ -290,7 +290,7 @@ int unsetenv(const char* name)
|
|||
|
||||
int setenv(const char* name, const char* value, int overwrite)
|
||||
{
|
||||
if (!overwrite && !getenv(name))
|
||||
if (!overwrite && getenv(name))
|
||||
return 0;
|
||||
auto length = strlen(name) + strlen(value) + 2;
|
||||
auto* var = (char*)malloc(length);
|
||||
|
|
Loading…
Reference in a new issue