diff --git a/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp b/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp index d9d909343813..5578748829d4 100644 --- a/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp +++ b/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp @@ -1111,7 +1111,8 @@ ProcessMonitor::Launch(LaunchArgs *args) eDupStdoutFailed, eDupStderrFailed, eChdirFailed, - eExecFailed + eExecFailed, + eSetGidFailed }; // Child process. @@ -1122,7 +1123,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); @@ -1187,6 +1189,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;