From e752c726edfae419b7330d3cbbe3a3d53c83b0fd Mon Sep 17 00:00:00 2001 From: rustdesk Date: Thu, 29 Jun 2023 23:46:00 +0800 Subject: [PATCH] workaround of issue #2756 --- src/platform/linux.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/platform/linux.rs b/src/platform/linux.rs index 8852b024f..bbe415c71 100644 --- a/src/platform/linux.rs +++ b/src/platform/linux.rs @@ -667,8 +667,12 @@ pub fn check_super_user_permission() -> ResultType { } else { arg = "echo"; } - let status = exec_privileged(&[arg])?.wait()?; - Ok(status.success() && status.code() == Some(0)) + // https://github.com/rustdesk/rustdesk/issues/2756 + if let Ok(status) = Command::new("pkexec").arg(arg).status() { + Ok(status.code() != Some(126)) + } else { + Ok(true) + } } pub fn elevate(args: Vec<&str>) -> ResultType {