[Lldb-commits] [lldb] r197634 - <rdar://problem/15639995>
Han Ming Ong
hanming at apple.com
Wed Dec 18 16:35:40 PST 2013
Author: hanming
Date: Wed Dec 18 18:35:40 2013
New Revision: 197634
URL: http://llvm.org/viewvc/llvm-project?rev=197634&view=rev
Log:
<rdar://problem/15639995>
Allow the root XPC launcher to launch any target as root.
Modified:
lldb/trunk/source/Host/macosx/Host.mm
Modified: lldb/trunk/source/Host/macosx/Host.mm
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Host.mm?rev=197634&r1=197633&r2=197634&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/Host.mm (original)
+++ lldb/trunk/source/Host/macosx/Host.mm Wed Dec 18 18:35:40 2013
@@ -1728,29 +1728,18 @@ LaunchProcessPosixSpawn (const char *exe
}
static bool
-ShouldLaunchUsingXPC(const char *exe_path, ProcessLaunchInfo &launch_info)
+ShouldLaunchUsingXPC(ProcessLaunchInfo &launch_info)
{
bool result = false;
#if !NO_XPC_SERVICES
- const char *debugserver = "/debugserver";
- int len = strlen(debugserver);
- int exe_len = strlen(exe_path);
- if (exe_len >= len)
- {
- const char *part = exe_path + (exe_len - len);
- if (strcmp(part, debugserver) == 0)
- {
- // We are dealing with debugserver.
- bool launchingAsRoot = launch_info.GetUserID() == 0;
- bool currentUserIsRoot = Host::GetEffectiveUserID() == 0;
-
- if (launchingAsRoot && !currentUserIsRoot)
- {
- // If current user is already root, we don't need XPC's help.
- result = true;
- }
- }
+ bool launchingAsRoot = launch_info.GetUserID() == 0;
+ bool currentUserIsRoot = Host::GetEffectiveUserID() == 0;
+
+ if (launchingAsRoot && !currentUserIsRoot)
+ {
+ // If current user is already root, we don't need XPC's help.
+ result = true;
}
#endif
@@ -1807,7 +1796,7 @@ Host::LaunchProcess (ProcessLaunchInfo &
::pid_t pid = LLDB_INVALID_PROCESS_ID;
- if (ShouldLaunchUsingXPC(exe_path, launch_info))
+ if (ShouldLaunchUsingXPC(launch_info))
{
error = LaunchProcessXPC(exe_path, launch_info, pid);
}
More information about the lldb-commits
mailing list