summaryrefslogtreecommitdiffstats
path: root/api.c
diff options
context:
space:
mode:
authorBalbir Singh <balbir@linux.vnet.ibm.com>2008-05-30 18:01:00 +0000
committerBalbir Singh <balbir@linux.vnet.ibm.com>2008-05-30 18:01:00 +0000
commit4f422b650ff4f33fde2a0a5b4167150c2f58b461 (patch)
tree73e2ab9c219eb8273b2508f34444654f156ed5b4 /api.c
parent33b354a4c8c85a90ab4ac32c2a75f23a7eb8f81b (diff)
downloadlibcg-4f422b650ff4f33fde2a0a5b4167150c2f58b461.tar.gz
libcg-4f422b650ff4f33fde2a0a5b4167150c2f58b461.tar.xz
libcg-4f422b650ff4f33fde2a0a5b4167150c2f58b461.zip
Fix more api.c warnings
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/tags/v0.1b@68 4f4bb910-9a46-0410-90c8-c897d4f1cd53
Diffstat (limited to 'api.c')
-rw-r--r--api.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/api.c b/api.c
index b60d534..a279631 100644
--- a/api.c
+++ b/api.c
@@ -114,6 +114,7 @@ int cgroup_init()
int i=0;
char *mntopt;
int err;
+ char *buf;
proc_cgroup = fopen("/proc/cgroups", "r");
@@ -126,7 +127,10 @@ int cgroup_init()
*
* XX: fix the size for fgets
*/
- fgets(subsys_name, FILENAME_MAX, proc_cgroup);
+ buf = fgets(subsys_name, FILENAME_MAX, proc_cgroup);
+ if (!buf)
+ return EIO;
+
while (!feof(proc_cgroup)) {
err = fscanf(proc_cgroup, "%s %d %d %d", subsys_name,
&hierarchy, &num_cgroups, &enabled);
@@ -409,7 +413,7 @@ err:
int cgroup_create_cgroup(struct cgroup *cgroup, int ignore_ownership)
{
char *fts_path[2], base[FILENAME_MAX], *path;
- int i, j, k;
+ int j, k;
int error = 0;
fts_path[0] = (char *)malloc(FILENAME_MAX);
@@ -484,7 +488,7 @@ int cgroup_delete_cgroup(struct cgroup *cgroup, int ignore_migration)
int tids;
char path[FILENAME_MAX];
int error = ECGROUPNOTALLOWED;
- int i;
+ int i, ret;
for (i = 0; i < CG_CONTROLLER_MAX && cgroup->controller; i++) {
if (!cg_build_path(cgroup->name, path,
@@ -507,7 +511,11 @@ int cgroup_delete_cgroup(struct cgroup *cgroup, int ignore_migration)
goto del_open_err;
while (!feof(delete_tasks)) {
- fscanf(delete_tasks, "%d", &tids);
+ ret = fscanf(delete_tasks, "%d", &tids);
+ /*
+ * Don't know how to handle EOF yet, so
+ * ignore it
+ */
fprintf(base_tasks, "%d", tids);
}