From: Dhaval Giani Date: Fri, 15 Aug 2008 05:10:28 +0000 (+0000) Subject: libcgroup: Some cgexec cleanups X-Git-Tag: v0.34~231 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9afa39fdf3b76ed6c1c14c9b6c25d15bf675549;p=thirdparty%2Flibcgroup.git libcgroup: Some cgexec cleanups From: Vivek Goyal cgexec cleanup based on balbir's feedback. Signed-off-by: Vivek Goyal Signed-off-by: Dhaval Giani git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@160 4f4bb910-9a46-0410-90c8-c897d4f1cd53 --- diff --git a/cgexec.c b/cgexec.c index d91207f1..9558bca0 100644 --- a/cgexec.c +++ b/cgexec.c @@ -28,8 +28,6 @@ #include #include -#define CG_HIER_MAX CG_CONTROLLER_MAX -#define CG_CONT_NAMELEN_MAX 128 struct cgroup_data { char path[FILENAME_MAX]; @@ -84,14 +82,12 @@ int parse_cgroup_data(struct cgroup_data *cdptr[], char *optarg) temp = strtok(NULL, ","); if (temp) { - cdptr[i]->controllers[j] = - (char *) malloc(strlen(temp) + 1); + cdptr[i]->controllers[j] = strdup(temp); if (!cdptr[i]->controllers[j]) { free(cdptr[i]); fprintf(stderr, "%s\n", strerror(errno)); return -1; - } else - strcpy(cdptr[i]->controllers[j], temp); + } } j++; } while (temp);