Commit 49dd1c6f authored by Arora Aashish's avatar Arora Aashish

Bug 1685880 - Fix for the gcc compiler version 7 to support setenv with nss build. r=rrelyea

Differential Revision: https://phabricator.services.mozilla.com/D104418

--HG--
extra : moz-landing-system : lando
parent 56ca2eea
......@@ -740,8 +740,14 @@ NSS_PutEnv(const char *envVarName, const char *envValue)
SET_ERROR_CODE
return SECFailure;
}
#endif
#elif defined(__GNUC__) && __GNUC__ >= 7
int setEnvFailed;
setEnvFailed = setenv(envVarName, envValue, 1);
if (setEnvFailed) {
SET_ERROR_CODE
return SECFailure;
}
#else
encoded = (char *)PORT_ZAlloc(strlen(envVarName) + 2 + strlen(envValue));
if (!encoded) {
return SECFailure;
......@@ -749,13 +755,14 @@ NSS_PutEnv(const char *envVarName, const char *envValue)
strcpy(encoded, envVarName);
strcat(encoded, "=");
strcat(encoded, envValue);
putEnvFailed = putenv(encoded); /* adopt. */
if (putEnvFailed) {
SET_ERROR_CODE
result = SECFailure;
PORT_Free(encoded);
}
#endif
return result;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment