<xfce4-taskmanager:master> Temporary âfixâ of a nasty segfault
Mike Massonnet
noreply at xfce.org
Fri May 7 21:54:02 CEST 2010
Updating branch refs/heads/master
to 553be8eee1d3a0e496d2f24dfb7b54c4e057ce7e (commit)
from 239c5d5064a915d0cca17abcb079c1a558dc95cf (commit)
commit 553be8eee1d3a0e496d2f24dfb7b54c4e057ce7e
Author: Mike Massonnet <mmassonnet at xfce.org>
Date: Fri May 7 21:07:33 2010 +0200
Temporary “fix” of a nasty segfault
On the Linux implementation, when a process name has a space in it the
sscanf function is unable to parse the line properly. This will have to
be changed, but in the meantime ignore such processes and avoid the
segfault, there are going to be Beta releases.
src/task-manager-linux.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/src/task-manager-linux.c b/src/task-manager-linux.c
index 44704fe..56583cb 100644
--- a/src/task-manager-linux.c
+++ b/src/task-manager-linux.c
@@ -195,12 +195,13 @@ get_task_details (guint pid, Task *task)
gulong jiffies_user, jiffies_system;
struct passwd *pw;
struct stat sstat;
+ guint ppid = 0;
sscanf(buffer, "%i %255s %1s %i %i %i %i %i %255s %255s %255s %255s %255s %i %i %i %i %i %i %i %i %i %i %i %255s %255s %255s %i %255s %255s %255s %255s %255s %255s %255s %255s %255s %255s %i %255s %255s",
&task->pid, // processid
task->name, // processname
task->state, // processstate
- &task->ppid, // parentid
+ &ppid, // parentid
&idummy, // processs groupid
&idummy, // session id
@@ -248,6 +249,11 @@ get_task_details (guint pid, Task *task)
dummy
);
+ // FIXME sscanf sucks, big news, process names with spaces don't pass
+ if (ppid == 0)
+ return FALSE;
+
+ task->ppid = ppid;
task->rss *= get_pagesize ();
get_cpu_percent (task->pid, jiffies_user, &task->cpu_user, jiffies_system, &task->cpu_system);
More information about the Xfce4-commits
mailing list