mirror of https://github.com/Icinga/icinga2.git
Fix don't set LC_NUMERIC twice
This commit is contained in:
parent
04704a49a4
commit
24c6210ef2
|
@ -100,23 +100,30 @@ static Value ProcessSpawnImpl(struct msghdr *msgh, const Dictionary::Ptr& reques
|
||||||
envc++;
|
envc++;
|
||||||
|
|
||||||
auto **envp = new char *[envc + (extraEnvironment ? extraEnvironment->GetLength() : 0) + 2];
|
auto **envp = new char *[envc + (extraEnvironment ? extraEnvironment->GetLength() : 0) + 2];
|
||||||
|
const char* lcnumeric = "LC_NUMERIC=";
|
||||||
|
int j = 0;
|
||||||
|
|
||||||
for (int i = 0; i < envc; i++)
|
for (int i = 0; i < envc; i++) {
|
||||||
envp[i] = strdup(environ[i]);
|
if (strncmp(environ[i], lcnumeric, strlen(lcnumeric)) == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
envp[j] = strdup(environ[i]);
|
||||||
|
++j;
|
||||||
|
}
|
||||||
|
|
||||||
if (extraEnvironment) {
|
if (extraEnvironment) {
|
||||||
ObjectLock olock(extraEnvironment);
|
ObjectLock olock(extraEnvironment);
|
||||||
|
|
||||||
int index = envc;
|
|
||||||
for (const Dictionary::Pair& kv : extraEnvironment) {
|
for (const Dictionary::Pair& kv : extraEnvironment) {
|
||||||
String skv = kv.first + "=" + Convert::ToString(kv.second);
|
String skv = kv.first + "=" + Convert::ToString(kv.second);
|
||||||
envp[index] = strdup(skv.CStr());
|
envp[j] = strdup(skv.CStr());
|
||||||
index++;
|
j++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
envp[envc + (extraEnvironment ? extraEnvironment->GetLength() : 0)] = strdup("LC_NUMERIC=C");
|
envp[j] = strdup("LC_NUMERIC=C");
|
||||||
envp[envc + (extraEnvironment ? extraEnvironment->GetLength() : 0) + 1] = nullptr;
|
envp[j + 1] = nullptr;
|
||||||
|
|
||||||
extraEnvironment.reset();
|
extraEnvironment.reset();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue