From 68b3fe6b19a372b139cfb2e8629eb172e9365e7f Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 19 Oct 2011 07:49:23 +0000 Subject: [PATCH] - client: fix crashing bug when there's a cycle in the process graph. I had fixed this in one place but not another. - client: don't memset(0,) a PROCINFO; use clear() instead svn path=/trunk/boinc/; revision=24431 --- checkin_notes | 27 +++++++++++++++++++-------- lib/proc_control.cpp | 7 +++++-- lib/procinfo_mac.cpp | 2 +- lib/procinfo_unix.cpp | 4 ++-- lib/procinfo_win.cpp | 1 + 5 files changed, 28 insertions(+), 13 deletions(-) diff --git a/checkin_notes b/checkin_notes index 7843cc27aa..8d9acd33da 100644 --- a/checkin_notes +++ b/checkin_notes @@ -7300,9 +7300,9 @@ David 14 Oct 2011 work_fetch.cpp David 14 Oct 2011 - - client: bug fix for the above - client/ - work_fetch.cpp + - client: bug fix for the above + client/ + work_fetch.cpp David 14 Oct 2011 - scheduler: in cuda_check(), ati_check() and opencl_check() @@ -7468,9 +7468,20 @@ David 18 Oct 2011 cpu_sched.cpp David 18 Oct 2011 - - client: fix bug that caused extra "<" to get written at - end of global_prefs_override.xml and cc_config.xml - when they are modified via GUI RPCs + - client: fix bug that caused extra "<" to get written at + end of global_prefs_override.xml and cc_config.xml + when they are modified via GUI RPCs - client/ - gui_rpc_server_ops.cpp + client/ + gui_rpc_server_ops.cpp + +David 19 Oct 2011 + - client: fix crashing bug when there's a cycle in the process graph. + I had fixed this in one place but not another. + - client: don't memset(0,) a PROCINFO; use clear() instead + + lib/ + proc_control.cpp + procinfo_mac.cpp + procinfo_unix.cpp + procinfo_win.cpp diff --git a/lib/proc_control.cpp b/lib/proc_control.cpp index d4d0864297..ac7777189e 100644 --- a/lib/proc_control.cpp +++ b/lib/proc_control.cpp @@ -48,8 +48,11 @@ using std::vector; static void get_descendants_aux(PROC_MAP& pm, int pid, vector& pids) { PROC_MAP::iterator i = pm.find(pid); if (i == pm.end()) return; - for (unsigned int j=0; jsecond.children.size(); j++) { - int child_pid = i->second.children[j]; + PROCINFO& p = i->second; + if (p.scanned) return; // avoid infinite recursion + p.scanned = true; + for (unsigned int j=0; jd_name); fd = fopen(pidpath, "r"); if (fd) { - memset(&p, 0, sizeof(p)); + p.clear(); if (fread(&psinfo, sizeof(psinfo_t), 1, fd) == 1) { p.id = psinfo.pr_pid; p.parentid = psinfo.pr_ppid; @@ -225,7 +225,7 @@ int procinfo_setup(PROC_MAP& pm) { if (retval) { final_retval = retval; } else { - memset(&p, 0, sizeof(p)); + p.clear(); p.id = ps.pid; p.parentid = ps.ppid; p.swap_size = ps.vsize; diff --git a/lib/procinfo_win.cpp b/lib/procinfo_win.cpp index 2b34409c12..e54cda1642 100644 --- a/lib/procinfo_win.cpp +++ b/lib/procinfo_win.cpp @@ -87,6 +87,7 @@ int get_procinfo_XP(PROC_MAP& pm) { pProcesses = (PSYSTEM_PROCESSES)pBuffer; while (pProcesses) { PROCINFO p; + p.clear(); p.id = pProcesses->ProcessId; p.parentid = pProcesses->InheritedFromProcessId; p.swap_size = pProcesses->VmCounters.PagefileUsage;