mirror of https://github.com/Icinga/icinga2.git
Merge pull request #8085 from Icinga/bugfix/not-set-lcnumeric-twice-7563
Fix LC_NUMERIC set twice and use a wrong value
This commit is contained in:
commit
9c232e942b
|
@ -100,23 +100,30 @@ static Value ProcessSpawnImpl(struct msghdr *msgh, const Dictionary::Ptr& reques
|
|||
envc++;
|
||||
|
||||
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++)
|
||||
envp[i] = strdup(environ[i]);
|
||||
for (int i = 0; i < envc; i++) {
|
||||
if (strncmp(environ[i], lcnumeric, strlen(lcnumeric)) == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
envp[j] = strdup(environ[i]);
|
||||
++j;
|
||||
}
|
||||
|
||||
if (extraEnvironment) {
|
||||
ObjectLock olock(extraEnvironment);
|
||||
|
||||
int index = envc;
|
||||
for (const Dictionary::Pair& kv : extraEnvironment) {
|
||||
String skv = kv.first + "=" + Convert::ToString(kv.second);
|
||||
envp[index] = strdup(skv.CStr());
|
||||
index++;
|
||||
envp[j] = strdup(skv.CStr());
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
envp[envc + (extraEnvironment ? extraEnvironment->GetLength() : 0)] = strdup("LC_NUMERIC=C");
|
||||
envp[envc + (extraEnvironment ? extraEnvironment->GetLength() : 0) + 1] = nullptr;
|
||||
envp[j] = strdup("LC_NUMERIC=C");
|
||||
envp[j + 1] = nullptr;
|
||||
|
||||
extraEnvironment.reset();
|
||||
|
||||
|
|
Loading…
Reference in New Issue