mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-05-23 18:37:19 +02:00
(#1693) Notify user if /tmp directory has noexec
mount option
Minecraft versions starting from 1.19 would not start at all if /tmp is mounted as `noexec`. Signed-off-by: bit6tream <megapixel483@gmail.com>
This commit is contained in:
parent
e499aa4783
commit
681e76c551
@ -82,6 +82,7 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <mutex>
|
||||
#include <string_view>
|
||||
|
||||
#include <QAccessible>
|
||||
#include <QCommandLineParser>
|
||||
@ -132,6 +133,10 @@
|
||||
#include "gamemode_client.h"
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD)
|
||||
#include <mntent.h>
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_MAC)
|
||||
#if defined(SPARKLE_ENABLED)
|
||||
#include "updater/MacSparkleUpdater.h"
|
||||
@ -988,6 +993,36 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD)
|
||||
|
||||
// notify user if /tmp is mounted with `noexec` (#1693)
|
||||
{
|
||||
FILE* description = setmntent(MOUNTED, "r");
|
||||
mntent* info = nullptr;
|
||||
|
||||
while ((info = getmntent(description)) != nullptr) {
|
||||
std::string_view directory = info->mnt_dir;
|
||||
std::string_view options = info->mnt_opts;
|
||||
|
||||
if (directory == "/tmp" && options.rfind("noexec") != std::string_view::npos) {
|
||||
auto infoMsg =
|
||||
tr("Your /tmp directory is currently mounted with the 'noexec' flag enabled.\n"
|
||||
"Some versions of Minecraft may not launch.\n");
|
||||
auto msgBox = new QMessageBox(QMessageBox::Information, tr("Incompatible system configuration"), infoMsg, QMessageBox::Ok);
|
||||
msgBox->setDefaultButton(QMessageBox::Ok);
|
||||
msgBox->setAttribute(Qt::WA_DeleteOnClose);
|
||||
msgBox->setMinimumWidth(460);
|
||||
msgBox->adjustSize();
|
||||
msgBox->open();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
endmntent(description);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if (createSetupWizard()) {
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user