summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBalbir Singh <balbir@linux.vnet.ibm.com>2008-04-16 11:59:32 +0000
committerBalbir Singh <balbir@linux.vnet.ibm.com>2008-04-16 11:59:32 +0000
commit0789973a4b487961f70c5eb6c31bb3c1e1589b71 (patch)
tree6e13bfb6d56764c8af0ee5b8b984e58fba87a783 /tests
parent00e35b2d6a970edbb790b901fb7499f0f85e91b3 (diff)
downloadlibcg-0789973a4b487961f70c5eb6c31bb3c1e1589b71.tar.gz
libcg-0789973a4b487961f70c5eb6c31bb3c1e1589b71.tar.xz
libcg-0789973a4b487961f70c5eb6c31bb3c1e1589b71.zip
use getgrnam() for groups
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/branches/balbir@17 4f4bb910-9a46-0410-90c8-c897d4f1cd53
Diffstat (limited to 'tests')
-rw-r--r--tests/libcg_ba.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/libcg_ba.cpp b/tests/libcg_ba.cpp
index 6406dda..a820196 100644
--- a/tests/libcg_ba.cpp
+++ b/tests/libcg_ba.cpp
@@ -55,6 +55,7 @@ struct cgroup *cg::makenode(const string &name, const string &task_uid,
gid_t tgid, cgid;
struct cgroup *ccg;
struct passwd *passwd;
+ struct group *grp;
int ret;
ccg = (struct cgroup *)malloc(sizeof(*ccg));
@@ -64,20 +65,20 @@ struct cgroup *cg::makenode(const string &name, const string &task_uid,
return NULL;
tuid = passwd->pw_uid;
- passwd = getpwnam(task_gid.c_str());
- if (!passwd)
+ grp = getgrnam(task_gid.c_str());
+ if (!grp)
return NULL;
- tgid = passwd->pw_gid;
+ tgid = grp->gr_gid;
passwd = getpwnam(control_uid.c_str());
if (!passwd)
return NULL;
cuid = passwd->pw_uid;
- passwd = getpwnam(control_gid.c_str());
- if (!passwd)
+ grp = getgrnam(control_gid.c_str());
+ if (!grp)
return NULL;
- cgid = passwd->pw_gid;
+ cgid = grp->gr_gid;
dbg("tuid %d, tgid %d, cuid %d, cgid %d\n", tuid, tgid, cuid, cgid);