mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:27:43 +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
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)
|
int setenv(const char* name, const char* value, int overwrite)
|
||||||
{
|
{
|
||||||
if (!overwrite && !getenv(name))
|
if (!overwrite && getenv(name))
|
||||||
return 0;
|
return 0;
|
||||||
auto length = strlen(name) + strlen(value) + 2;
|
auto length = strlen(name) + strlen(value) + 2;
|
||||||
auto* var = (char*)malloc(length);
|
auto* var = (char*)malloc(length);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue