kdesudo: store the DISPLAY environment variable as QString

otherwise it will be converted as if it is ASCII later on several times

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-08-31 19:18:56 +03:00
parent 90dcef2ec2
commit a5017377d2

View file

@ -137,7 +137,7 @@ KdeSudo::KdeSudo(const QString &icon, const QString &appname)
// 'man xauth' for more info on xauth cookies.
m_tmpName = KTemporaryFile::filePath("/tmp/kdesudo-XXXXXXXXXX-xauth");
QByteArray disp = qgetenv("DISPLAY");
const QString disp = QString::fromLocal8Bit(qgetenv("DISPLAY"));
if (disp.isEmpty()) {
kError() << "$DISPLAY is not set.";
exit(1);
@ -151,7 +151,7 @@ KdeSudo::KdeSudo(const QString &icon, const QString &appname)
xauth_ext.setStandardOutputProcess(&xauth_merge);
// Start the first
xauth_ext.start("xauth", QStringList() << "extract" << "-" << QString::fromLocal8Bit(disp), QIODevice::ReadOnly);
xauth_ext.start("xauth", QStringList() << "extract" << "-" << disp, QIODevice::ReadOnly);
if (!xauth_ext.waitForStarted()) {
return;
}