[Lldb-commits] [lldb] r191230 - <rdar://problem/14701270>

Han Ming Ong hanming at apple.com
Mon Sep 23 15:09:17 PDT 2013


Author: hanming
Date: Mon Sep 23 17:09:17 2013
New Revision: 191230

URL: http://llvm.org/viewvc/llvm-project?rev=191230&view=rev
Log:
<rdar://problem/14701270>
When logged in as root, just launch debugserver regularly.

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=191230&r1=191229&r2=191230&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/Host.mm (original)
+++ lldb/trunk/source/Host/macosx/Host.mm Mon Sep 23 17:09:17 2013
@@ -1745,11 +1745,12 @@ ShouldLaunchUsingXPC(const char *exe_pat
         if (strcmp(part, debugserver) == 0)
         {
             // We are dealing with debugserver.
-            uid_t requested_uid = launch_info.GetUserID();
-            if (requested_uid == 0)
+            bool launchingAsRoot = launch_info.GetUserID() == 0;
+            bool currentUserIsRoot = Host::GetEffectiveUserID() == 0;
+            
+            if (launchingAsRoot && !currentUserIsRoot)
             {
-                // Launching XPC works for root. It also works for the non-attaching case for current login
-                // but unfortunately, we can't detect it here.
+                // If current user is already root, we don't need XPC's help.
                 result = true;
             }
         }





More information about the lldb-commits mailing list