Android: Fix env vars parsing

env var values might contain '=' char, so we can't use split.

Change-Id: Iedf3ea46a847acaaf02f51bc80586a519fe7a310
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
BogDan Vatra 2019-08-15 07:37:06 +03:00
parent c00487d588
commit 77160d2923

View File

@ -454,9 +454,9 @@ static jboolean startQtAndroidPlugin(JNIEnv *env, jobject /*object*/, jstring pa
const QList<QByteArray> envVars = QByteArray(nativeString).split('\t');
env->ReleaseStringUTFChars(environmentString, nativeString);
for (const QByteArray &envVar : envVars) {
const QList<QByteArray> envVarPair = envVar.split('=');
if (envVarPair.size() == 2 && ::setenv(envVarPair[0], envVarPair[1], 1) != 0)
qWarning() << "Can't set environment" << envVarPair;
int pos = envVar.indexOf('=');
if (pos != -1 && ::setenv(envVar.left(pos), envVar.mid(pos + 1), 1) != 0)
qWarning() << "Can't set environment" << envVar;
}
}