summaryrefslogtreecommitdiffstats
path: root/api.c
diff options
context:
space:
mode:
authorBalbir Singh <balbir@linux.vnet.ibm.com>2008-05-30 17:50:23 +0000
committerBalbir Singh <balbir@linux.vnet.ibm.com>2008-05-30 17:50:23 +0000
commit33b354a4c8c85a90ab4ac32c2a75f23a7eb8f81b (patch)
tree41e3cc8764d2af560515eaf0957b35d34ebb071d /api.c
parentdf1357a592d94389273708c70a7c415e9dc15d6d (diff)
downloadlibcg-33b354a4c8c85a90ab4ac32c2a75f23a7eb8f81b.tar.gz
libcg-33b354a4c8c85a90ab4ac32c2a75f23a7eb8f81b.tar.xz
libcg-33b354a4c8c85a90ab4ac32c2a75f23a7eb8f81b.zip
Fix api.c warnings, include wrapper.c in Makefile. More changes to
spec file based on bugzilla input. Removed %makeinstall Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/tags/v0.1b@67 4f4bb910-9a46-0410-90c8-c897d4f1cd53
Diffstat (limited to 'api.c')
-rw-r--r--api.c36
1 files changed, 7 insertions, 29 deletions
diff --git a/api.c b/api.c
index fce70a7..b60d534 100644
--- a/api.c
+++ b/api.c
@@ -104,10 +104,9 @@ static int cg_chown_recursive(char **path, uid_t owner, gid_t group)
int cgroup_init()
{
FILE *proc_mount;
- struct mntent *ent, *found_ent = NULL;
+ struct mntent *ent;
int found_mnt = 0;
int ret = 0;
- char *mntent_tok;
static char *controllers[CG_CONTROLLER_MAX];
FILE *proc_cgroup;
char subsys_name[FILENAME_MAX];
@@ -179,31 +178,6 @@ int cgroup_init()
return ret;
}
-static char **get_mounted_controllers(char *mountpoint)
-{
- char **controllers;
- int i, j;
-
- i = 0;
- j = 0;
-
- controllers = (char **) malloc(sizeof(char *) * CG_CONTROLLER_MAX);
-
- for (i = 0; i < CG_CONTROLLER_MAX && cg_mount_table[i].name != NULL;
- i++) {
- if (strcmp(cg_mount_table[i].name, mountpoint) == 0) {
- controllers[j] = (char *)malloc(sizeof(char) *
- FILENAME_MAX);
- strcpy(controllers[j], cg_mount_table[i].name);
- j++;
- }
- }
- controllers[j] = (char *)malloc(sizeof(char) * FILENAME_MAX);
- controllers[j][0] = '\0';
-
- return controllers;
-}
-
static int cg_test_mounted_fs()
{
FILE *proc_mount;
@@ -350,7 +324,6 @@ static int cg_create_control_group(char *path)
*/
static int cg_set_control_value(char *path, char *val)
{
- int error;
FILE *control_file;
if (!cg_test_mounted_fs())
return ECGROUPNOTMOUNTED;
@@ -486,7 +459,12 @@ int cgroup_create_cgroup(struct cgroup *cgroup, int ignore_ownership)
if (!ignore_ownership) {
strcpy(path, base);
strcat(path, "/tasks");
- chown(path, cgroup->tasks_uid, cgroup->tasks_gid);
+ error = chown(path, cgroup->tasks_uid,
+ cgroup->tasks_gid);
+ if (!error) {
+ error = ECGFAIL;
+ goto err;
+ }
}
}