Only perform the login_session_has_gui_access on macOS

This commit is contained in:
Jason Molenda 2020-02-10 18:16:15 -08:00
parent 86500b3f1c
commit 9ed9742ec0
1 changed files with 6 additions and 0 deletions

View File

@ -3741,12 +3741,17 @@ static bool process_is_already_being_debugged (nub_process_t pid) {
// for debug permission by popping up a dialog box and attach
// may fail outright).
static bool login_session_has_gui_access () {
// I believe this API only works on macOS.
#if TARGET_OS_OSX == 0
return true;
#else
auditinfo_addr_t info;
getaudit_addr(&info, sizeof(info));
if (info.ai_flags & AU_SESSION_FLAG_HAS_GRAPHIC_ACCESS)
return true;
else
return false;
#endif
}
// Checking for
@ -3766,6 +3771,7 @@ static bool login_session_has_gui_access () {
// $ security authorizationdb read system.privilege.taskport.debug
static bool developer_mode_enabled () {
// This API only exists on macOS.
#if TARGET_OS_OSX == 0
return true;
#else