From 45132e2b226dd9a957e6f5446bd7a2603d4c0701 Mon Sep 17 00:00:00 2001 From: Prasad Joshi Date: Mon, 17 Sep 2012 22:04:09 +0530 Subject: [PATCH] ps: fix uid and gid in the ps output The function fill_team_info() completely ignored the user id and the group id of the process (fields info->uid and info->gid respectively). Since the info structure was zeroed earlier, the ps output showed uid and gid of each process equal to zero. The patch fixes the problem by properly initializing the members with effective uid and gid. Now the output is correct. Fixes #8995. Signed-off-by: Ryan Leavengood --- src/bin/ps.c | 2 +- src/system/kernel/team.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bin/ps.c b/src/bin/ps.c index 92416ceb96..bc5fb0788b 100644 --- a/src/bin/ps.c +++ b/src/bin/ps.c @@ -29,7 +29,7 @@ printTeamInfo(team_info *teamInfo, bool printHeader) "Uid"); printf("%-50s %5ld %8ld %4d %4d\n", teamInfo->args, teamInfo->team, - teamInfo->thread_count, teamInfo->uid, teamInfo->gid); + teamInfo->thread_count, teamInfo->gid, teamInfo->uid); } diff --git a/src/system/kernel/team.cpp b/src/system/kernel/team.cpp index b794b07b30..62a3677369 100644 --- a/src/system/kernel/team.cpp +++ b/src/system/kernel/team.cpp @@ -2494,8 +2494,8 @@ fill_team_info(Team* team, team_info* info, size_t size) //info->area_count = info->debugger_nub_thread = team->debug_info.nub_thread; info->debugger_nub_port = team->debug_info.nub_port; - //info->uid = - //info->gid = + info->uid = team->effective_uid; + info->gid = team->effective_gid; strlcpy(info->args, team->Args(), sizeof(info->args)); info->argc = 1;