struct cg_mount_point *mount, *it;
mount = malloc(sizeof(struct cg_mount_point));
- if (!mount)
- return ECGFAIL;
+ if (!mount) {
+ last_errno = errno;
+ return ECGOTHER;
+ }
mount->next = NULL;
strncpy(mount->path, path, sizeof(mount->path));
mount->path[sizeof(mount->path)-1] = '\0';
dst->values[i] = calloc(1, sizeof(struct control_value));
if (!dst->values[i]) {
- ret = ECGFAIL;
+ last_errno = errno;
+ ret = ECGOTHER;
goto err;
}
dst->controller[i] = calloc(1, sizeof(struct cgroup_controller));
if (!dst->controller[i]) {
- ret = ECGFAIL;
+ last_errno = errno;
+ ret = ECGOTHER;
goto err;
}
dir = strdup(cgroup->name);
if (!dir) {
- return ECGFAIL;
+ last_errno = errno;
+ return ECGOTHER;
}
cgroup_dbg("group name is %s\n", dir);
}
else {
*parent = strdup(pdir);
- if (*parent == NULL)
- ret = ECGFAIL;
+ if (*parent == NULL) {
+ last_errno = errno;
+ ret = ECGOTHER;
+ }
}
free(dir);
* it afterwards.
*/
parent_name = strdup(".");
- if (parent_name == NULL)
- return ECGFAIL;
+ if (parent_name == NULL) {
+ last_errno = errno;
+ return ECGOTHER;
+ }
delete_group = 0;
} else
/*
*dict = (struct cgroup_dictionary *) calloc(
1, sizeof(struct cgroup_dictionary));
- if (!dict)
- return ECGFAIL;
+ if (!dict) {
+ last_errno = errno;
+ return ECGOTHER;
+ }
(*dict)->flags = flags;
return 0;
}
it = (struct cgroup_dictionary_item *) malloc(
sizeof(struct cgroup_dictionary_item));
- if (!it)
- return ECGFAIL;
+ if (!it) {
+ last_errno = errno;
+ return ECGOTHER;
+ }
it->next = NULL;
it->name = name;
iter = (struct cgroup_dictionary_iterator *) malloc(
sizeof(struct cgroup_dictionary_iterator));
- if (!iter)
- return ECGFAIL;
+ if (!iter) {
+ last_errno = errno;
+ return ECGOTHER;
+ }
iter->item = dict->head;
*handle = iter;