diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2021-06-14 16:26:44 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2021-06-16 15:53:23 +0200 |
commit | 20f835329a35651c720b73a8d217e3b48ebd2fcf (patch) | |
tree | 78f033de837f1b3a4e92446c8537b7b6a89bbbad /src | |
parent | 01ff216c82fd33664a1d7c1d89e58a24e38b3000 (diff) |
macOS: Detect sandboxed state for command line apps
The documentation says that if we "pass a URL to the main
executable of a bundle, the bundle as a whole is generally
recognized.". By passing the executable instead of the
bundle we include command line applications that don't
have a app bundle folder (but have an embedded Info.plist).
Pick-to: 6.2 6.1 5.15
Change-Id: I3a2f145c1ec6e16607e9c04baf08678d5dea0b81
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/kernel/qcore_mac.mm | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/kernel/qcore_mac.mm b/src/corelib/kernel/qcore_mac.mm index 6bf61b1155..6a8db38cc3 100644 --- a/src/corelib/kernel/qcore_mac.mm +++ b/src/corelib/kernel/qcore_mac.mm @@ -401,8 +401,8 @@ bool qt_apple_isSandboxed() { static bool isSandboxed = []() { QCFType<SecStaticCodeRef> staticCode = nullptr; - NSURL *bundleUrl = [[NSBundle mainBundle] bundleURL]; - if (SecStaticCodeCreateWithPath((__bridge CFURLRef)bundleUrl, + NSURL *executableUrl = NSBundle.mainBundle.executableURL; + if (SecStaticCodeCreateWithPath((__bridge CFURLRef)executableUrl, kSecCSDefaultFlags, &staticCode) != errSecSuccess) return false; |