From b4b39258ac07a6ca2bad7ca75d2d289c340a8856 Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Sat, 1 Aug 2020 13:46:27 +0200 Subject: [PATCH] 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. --- Libraries/LibC/stdlib.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/LibC/stdlib.cpp b/Libraries/LibC/stdlib.cpp index cd3b3385bb5..368d01235dd 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);