From 01a4e17ca079688515474ca188846b7500d04fed Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Wed, 12 Aug 2026 19:26:38 +0000 Subject: [PATCH] Qt4: version-gate QApplication::setSetuidAllowed() Added in Qt 5.6, and only exists to lift a restriction Qt5 itself introduced (refusing to run setuid unless explicitly allowed via this call). Qt4 never had that restriction in the first place, so there's nothing to opt back into on Qt4 -- version-gate rather than remove, to leave the Qt6 build's behavior untouched. --- src/main.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 349cd89..aa81c84 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -170,8 +170,14 @@ int main(int argc, char* argv[]) /* Q_OS_MACOS (Qt 5.9+) doesn't exist on Qt4, which only defines * Q_OS_MAC (also still defined on every later Qt version). */ #if (defined(Q_OS_MACOS) || defined(Q_OS_MAC)) && defined(PROJ_ADMIN_PRIV_ELEVATION) - /* Re-launching with root privs on OS X needs Qt to allow setsuid */ +#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) + /* Re-launching with root privs on OS X needs Qt to allow setsuid. + * setSetuidAllowed() (added in Qt 5.6) exists only to lift a + * restriction Qt5 itself introduced (refusing to run setuid unless + * explicitly allowed); Qt4 never had that restriction, so there's + * nothing to do here on Qt4. */ QApplication::setSetuidAllowed(true); +#endif #endif QCoreApplication::setApplicationName(APP_NAME); QCoreApplication::setApplicationVersion(PROJECT_VERSION); -- 2.43.0