Ran the static analyzer on the codebase and found a few things.
llvm-svn: 160338
diff --git a/lldb/tools/debugserver/source/MacOSX/MachProcess.cpp b/lldb/tools/debugserver/source/MacOSX/MachProcess.cpp
index 4d78778..2dcbb67 100644
--- a/lldb/tools/debugserver/source/MacOSX/MachProcess.cpp
+++ b/lldb/tools/debugserver/source/MacOSX/MachProcess.cpp
@@ -421,8 +421,7 @@
{
DisableAllBreakpoints (true);
DisableAllWatchpoints (true);
- // The static analyzer complains about this, but just leave the following line in.
- clear_bps_and_wps = false;
+ //clear_bps_and_wps = false;
}
uint32_t thread_idx = m_thread_list.GetThreadIndexForThreadStoppedWithSignal (SIGSTOP);
if (thread_idx_ptr)
@@ -1865,18 +1864,20 @@
// If our parent is setgid, lets make sure we don't inherit those
// extra powers due to nepotism.
- ::setgid (getgid ());
+ if (::setgid (getgid ()) == 0)
+ {
- // Let the child have its own process group. We need to execute
- // this call in both the child and parent to avoid a race condition
- // between the two processes.
- ::setpgid (0, 0); // Set the child process group to match its pid
+ // Let the child have its own process group. We need to execute
+ // this call in both the child and parent to avoid a race condition
+ // between the two processes.
+ ::setpgid (0, 0); // Set the child process group to match its pid
- // Sleep a bit to before the exec call
- ::sleep (1);
+ // Sleep a bit to before the exec call
+ ::sleep (1);
- // Turn this process into
- ::execv (path, (char * const *)argv);
+ // Turn this process into
+ ::execv (path, (char * const *)argv);
+ }
// Exit with error code. Child process should have taken
// over in above exec call and if the exec fails it will
// exit the child process below.