From c4af8be615281bace00db677427728a1553acb57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Sun, 8 Dec 2019 18:22:34 +0100 Subject: [PATCH] wxIsPlatform64Bit: don't launch uname needlessly Don't execute uname in Unix version of wxIsPlatform64Bit () to determine if the current platform is 64-bit capable if the binary is already a 64bit one. This is consistent with how MSW implementation behaves and avoids a pointless invocation when running 64-bit binaries. As an added benefit, this prevents user harassment by macOS 10.15 if they launch a wx application from a "protected" location like ~/Desktop or ~/Downloads - apparently stat()ing CWD is considered evil and privacy-invading these days. --- src/unix/utilsunx.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/unix/utilsunx.cpp b/src/unix/utilsunx.cpp index 4cd0d6ade3..9681cc6354 100644 --- a/src/unix/utilsunx.cpp +++ b/src/unix/utilsunx.cpp @@ -1078,12 +1078,17 @@ bool wxGetUserName(wxChar *buf, int sz) bool wxIsPlatform64Bit() { +#if SIZEOF_VOID_P == 8 + (void)wxGetCommandOutput; + return true; // 64-bit programs run only on 64-bit platforms +#else const wxString machine = wxGetCommandOutput(wxT("uname -m")); // the test for "64" is obviously not 100% reliable but seems to work fine // in practice return machine.Contains(wxT("64")) || machine.Contains(wxT("alpha")); +#endif } #ifdef __LINUX__