"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/lxc/lxccontainer.c" between
lxc-4.0.9.tar.gz and lxc-4.0.10.tar.gz

About: LXC are userspace tools for the Linux kernel containers that let users easily create and manage system or application containers.

lxccontainer.c  (lxc-4.0.9):lxccontainer.c  (lxc-4.0.10)
skipping to change at line 2263 skipping to change at line 2263
/* Used by qsort and bsearch functions for comparing container names. */ /* Used by qsort and bsearch functions for comparing container names. */
static inline int container_cmp(struct lxc_container **first, static inline int container_cmp(struct lxc_container **first,
struct lxc_container **second) struct lxc_container **second)
{ {
return strcmp((*first)->name, (*second)->name); return strcmp((*first)->name, (*second)->name);
} }
static bool add_to_array(char ***names, char *cname, int pos) static bool add_to_array(char ***names, char *cname, int pos)
{ {
char **newnames = realloc(*names, (pos+1) * sizeof(char *)); char **newnames = (char**)realloc(*names, (pos+1) * sizeof(char *));
if (!newnames) { if (!newnames) {
ERROR("Out of memory"); ERROR("Out of memory");
return false; return false;
} }
*names = newnames; *names = newnames;
newnames[pos] = strdup(cname); newnames[pos] = strdup(cname);
if (!newnames[pos]) if (!newnames[pos])
return false; return false;
skipping to change at line 2321 skipping to change at line 2321
if(get_from_array(names, cname, size) != NULL) if(get_from_array(names, cname, size) != NULL)
return true; return true;
return false; return false;
} }
static bool remove_from_array(char ***names, char *cname, int size) static bool remove_from_array(char ***names, char *cname, int size)
{ {
char **result = get_from_array(names, cname, size); char **result = get_from_array(names, cname, size);
if (result != NULL) { if (result != NULL) {
free(result); size_t i = result - *names;
free(*result);
memmove(*names+i, *names+i+1, (size-i-1) * sizeof(char*));
char **newnames = (char**)realloc(*names, (size-1) * sizeof(char
*));
if (!newnames) {
ERROR("Out of memory");
return true;
}
*names = newnames;
return true; return true;
} }
return false; return false;
} }
static char **do_lxcapi_get_interfaces(struct lxc_container *c) static char **do_lxcapi_get_interfaces(struct lxc_container *c)
{ {
pid_t pid; pid_t pid;
int i, count = 0, pipefd[2]; int i, count = 0, pipefd[2];
skipping to change at line 5658 skipping to change at line 5667
out: out:
return ret; return ret;
} }
int list_all_containers(const char *lxcpath, char ***nret, int list_all_containers(const char *lxcpath, char ***nret,
struct lxc_container ***cret) struct lxc_container ***cret)
{ {
int i, ret, active_cnt, ct_cnt, ct_list_cnt; int i, ret, active_cnt, ct_cnt, ct_list_cnt;
char **active_name; char **active_name;
char **ct_name; char **ct_name = NULL;
struct lxc_container **ct_list = NULL; struct lxc_container **ct_list = NULL;
ct_cnt = list_defined_containers(lxcpath, &ct_name, NULL); ct_cnt = list_defined_containers(lxcpath, &ct_name, NULL);
if (ct_cnt < 0) if (ct_cnt < 0)
return ct_cnt; return ct_cnt;
active_cnt = list_active_containers(lxcpath, &active_name, NULL); active_cnt = list_active_containers(lxcpath, &active_name, NULL);
if (active_cnt < 0) { if (active_cnt < 0) {
ret = active_cnt; ret = active_cnt;
goto free_ct_name; goto free_ct_name;
 End of changes. 3 change blocks. 
3 lines changed or deleted 13 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)