Changeset View
Changeset View
Standalone View
Standalone View
src/kdeinit/kinit.cpp
Show First 20 Lines • Show All 1487 Lines • ▼ Show 20 Line(s) | 1486 | if (!qEnvironmentVariableIsEmpty("XAUTHORITY")) { | |||
---|---|---|---|---|---|
1488 | int i; | 1488 | int i; | ||
1489 | if ((i = display.lastIndexOf('.')) > display.lastIndexOf(':') && i >= 0) { | 1489 | if ((i = display.lastIndexOf('.')) > display.lastIndexOf(':') && i >= 0) { | ||
1490 | display.truncate(i); | 1490 | display.truncate(i); | ||
1491 | } | 1491 | } | ||
1492 | display.replace(':', '_'); | 1492 | display.replace(':', '_'); | ||
1493 | #ifdef __APPLE__ | 1493 | #ifdef __APPLE__ | ||
1494 | display.replace('/', '_'); | 1494 | display.replace('/', '_'); | ||
1495 | #endif | 1495 | #endif | ||
1496 | QString xauth = QDir::tempPath() + QLatin1String("/xauth-") | 1496 | QString xauth = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation) + QLatin1String("/xauth-") | ||
1497 | + QString::number(getuid()) + QLatin1Char('-') + QString::fromLocal8Bit(display); | 1497 | + QString::number(getuid()) + QLatin1Char('-') + QString::fromLocal8Bit(display); | ||
1498 | QSaveFile xauthfile(xauth); | 1498 | QSaveFile xauthfile(xauth); | ||
1499 | QFile xauthfrom(QFile::decodeName(qgetenv("XAUTHORITY"))); | 1499 | QFile xauthfrom(QFile::decodeName(qgetenv("XAUTHORITY"))); | ||
1500 | // Set umask to make sure the file permissions of xauthfile are correct | 1500 | // Set umask to make sure the file permissions of xauthfile are correct | ||
1501 | mode_t oldMask = umask(S_IRGRP | S_IROTH | S_IWGRP | S_IWOTH); | 1501 | mode_t oldMask = umask(S_IRGRP | S_IROTH | S_IWGRP | S_IWOTH); | ||
1502 | if (!xauthfrom.open(QFile::ReadOnly) || !xauthfile.open(QFile::WriteOnly) | 1502 | if (!xauthfrom.open(QFile::ReadOnly) || !xauthfile.open(QFile::WriteOnly) | ||
1503 | || xauthfile.write(xauthfrom.readAll()) != xauthfrom.size() || !xauthfile.commit()) { | 1503 | || xauthfile.write(xauthfrom.readAll()) != xauthfrom.size() || !xauthfile.commit()) { | ||
1504 | // error | 1504 | // error | ||
▲ Show 20 Lines • Show All 284 Lines • Show Last 20 Lines |