[Lldb-commits] [lldb] r200791 - If setgid fails for any reason, exit lldb.

Ed Maste emaste at freebsd.org
Tue Feb 4 11:37:15 PST 2014


Author: emaste
Date: Tue Feb  4 13:37:15 2014
New Revision: 200791

URL: http://llvm.org/viewvc/llvm-project?rev=200791&view=rev
Log:
If setgid fails for any reason, exit lldb.

This is SVN r191618 by Sylvestre Ledru applied to the FreeBSD
ProcessMonitor.

Modified:
    lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp

Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp?rev=200791&r1=200790&r2=200791&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp (original)
+++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp Tue Feb  4 13:37:15 2014
@@ -896,7 +896,8 @@ ProcessMonitor::Launch(LaunchArgs *args)
         eDupStdoutFailed,
         eDupStderrFailed,
         eChdirFailed,
-        eExecFailed
+        eExecFailed,
+        eSetGidFailed
     };
 
     // Child process.
@@ -907,7 +908,8 @@ ProcessMonitor::Launch(LaunchArgs *args)
             exit(ePtraceFailed);
 
         // Do not inherit setgid powers.
-        setgid(getgid());
+        if (setgid(getgid()) != 0)
+            exit(eSetGidFailed);
 
         // Let us have our own process group.
         setpgid(0, 0);
@@ -972,6 +974,9 @@ ProcessMonitor::Launch(LaunchArgs *args)
             case eExecFailed:
                 args->m_error.SetErrorString("Child exec failed.");
                 break;
+            case eSetGidFailed:
+                args->m_error.SetErrorString("Child setgid failed.");
+                break;
             default:
                 args->m_error.SetErrorString("Child returned unknown exit status.");
                 break;





More information about the lldb-commits mailing list