From: Vivek Goyal <vgoyal@redhat.com>
cgexec cleanup based on balbir's feedback.
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@160
4f4bb910-9a46-0410-90c8-
c897d4f1cd53
#include <sys/stat.h>
#include <sys/types.h>
-#define CG_HIER_MAX CG_CONTROLLER_MAX
-#define CG_CONT_NAMELEN_MAX 128
struct cgroup_data {
char path[FILENAME_MAX];
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);