summaryrefslogtreecommitdiff
path: root/Libraries/LibC/stdlib.cpp
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>2020-08-01 13:46:27 +0200
committerAndreas Kling <kling@serenityos.org>2020-08-01 16:46:04 +0200
commitb4b39258ac07a6ca2bad7ca75d2d289c340a8856 (patch)
tree7c2d673cd86fb332fb03c8f8efd201b2ab1aab82 /Libraries/LibC/stdlib.cpp
parent3d5abae17b08fab3e418da2c7cfe98652ff63f5d (diff)
downloadserenity-b4b39258ac07a6ca2bad7ca75d2d289c340a8856.zip
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.
Diffstat (limited to 'Libraries/LibC/stdlib.cpp')
-rw-r--r--Libraries/LibC/stdlib.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Libraries/LibC/stdlib.cpp b/Libraries/LibC/stdlib.cpp
index cd3b3385bb..368d01235d 100644
--- a/Libraries/LibC/stdlib.cpp
+++ b/Libraries/LibC/stdlib.cpp
@@ -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);