|
24 | 24 | #include <libproc.h> |
25 | 25 | #include "sandbox.h" |
26 | 26 | #include "mac_branding.h" |
| 27 | +extern int compareOSVersionTo(int toMajor, int toMinor); |
27 | 28 | #endif |
28 | 29 |
|
29 | 30 | #ifdef _WIN32 |
@@ -1501,34 +1502,36 @@ static void handle_run_graphics_app(GUI_RPC_CONN& grc) { |
1501 | 1502 | return; |
1502 | 1503 | } |
1503 | 1504 |
|
1504 | | - // As of MacOS 14.0, the legacyScreenSaver sandbox prevents using |
1505 | | - // bootstrap_look_up, so we launch a bridging utility to relay Mach |
1506 | | - // communications between the graphics apps and the legacyScreenSaver. |
1507 | | - if (gfx_ss_bridge_pid == 0) { |
1508 | | - need_to_launch_gfx_ss_bridge = true; |
1509 | | - } else if (waitpid(gfx_ss_bridge_pid, 0, WNOHANG)) { |
1510 | | - gfx_ss_bridge_pid = 0; |
1511 | | - need_to_launch_gfx_ss_bridge = true; |
1512 | | - } |
1513 | | - if (need_to_launch_gfx_ss_bridge) { |
1514 | | - if (g_use_sandbox) { |
1515 | | - |
1516 | | - snprintf(gfx_switcher_path, sizeof(gfx_switcher_path), |
1517 | | - "/Library/Screen Savers/%s.saver/Contents/Resources/gfx_switcher", |
1518 | | - saverName[iBrandID] |
1519 | | - ); |
| 1505 | + if (compareOSVersionTo(14, 0) >= 0) { |
| 1506 | + // As of MacOS 14.0, the legacyScreenSaver sandbox prevents using |
| 1507 | + // bootstrap_look_up, so we launch a bridging utility to relay Mach |
| 1508 | + // communications between the graphics apps and the legacyScreenSaver. |
| 1509 | + if (gfx_ss_bridge_pid == 0) { |
| 1510 | + need_to_launch_gfx_ss_bridge = true; |
| 1511 | + } else if (waitpid(gfx_ss_bridge_pid, 0, WNOHANG)) { |
| 1512 | + gfx_ss_bridge_pid = 0; |
| 1513 | + need_to_launch_gfx_ss_bridge = true; |
1520 | 1514 | } |
1521 | | - argv[0] = const_cast<char*>("gfx_switcher"); |
1522 | | - argv[1] = "-run_bridge"; |
1523 | | - argv[2] = gfx_switcher_path; |
1524 | | - argc = 3; |
1525 | | - if (!theScreensaverLoginUser.empty()) { |
1526 | | - argv[argc++] = "--ScreensaverLoginUser"; |
1527 | | - safe_strcpy(screensaverLoginUser, theScreensaverLoginUser.c_str()); |
1528 | | - argv[argc++] = screensaverLoginUser; |
| 1515 | + if (need_to_launch_gfx_ss_bridge) { |
| 1516 | + if (g_use_sandbox) { |
| 1517 | + |
| 1518 | + snprintf(gfx_switcher_path, sizeof(gfx_switcher_path), |
| 1519 | + "/Library/Screen Savers/%s.saver/Contents/Resources/gfx_switcher", |
| 1520 | + saverName[iBrandID] |
| 1521 | + ); |
| 1522 | + } |
| 1523 | + argv[0] = const_cast<char*>("gfx_switcher"); |
| 1524 | + argv[1] = "-run_bridge"; |
| 1525 | + argv[2] = gfx_switcher_path; |
| 1526 | + argc = 3; |
| 1527 | + if (!theScreensaverLoginUser.empty()) { |
| 1528 | + argv[argc++] = "--ScreensaverLoginUser"; |
| 1529 | + safe_strcpy(screensaverLoginUser, theScreensaverLoginUser.c_str()); |
| 1530 | + argv[argc++] = screensaverLoginUser; |
| 1531 | + } |
| 1532 | + argv[argc] = 0; |
| 1533 | + retval = run_program(current_dir, gfx_switcher_path, argc, argv, gfx_ss_bridge_pid); |
1529 | 1534 | } |
1530 | | - argv[argc] = 0; |
1531 | | - retval = run_program(current_dir, gfx_switcher_path, argc, argv, gfx_ss_bridge_pid); |
1532 | 1535 | } |
1533 | 1536 |
|
1534 | 1537 | if (slot == -1) { |
|
0 commit comments