diff options
author | Ben Wiederhake <BenWiederhake.GitHub@gmx.de> | 2020-08-01 13:46:27 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-01 16:46:04 +0200 |
commit | b4b39258ac07a6ca2bad7ca75d2d289c340a8856 (patch) | |
tree | 7c2d673cd86fb332fb03c8f8efd201b2ab1aab82 /Libraries/LibC/stdlib.cpp | |
parent | 3d5abae17b08fab3e418da2c7cfe98652ff63f5d (diff) | |
download | serenity-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.cpp | 2 |
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); |