Commit e2eae703 by Felix Abecassis

tools: fix usage of boolean function set_config_item

parent 93936fbc
...@@ -194,8 +194,8 @@ int main(int argc, char *argv[]) ...@@ -194,8 +194,8 @@ int main(int argc, char *argv[])
} }
} }
ret = lxc_config_define_load(&defines, c); bret = lxc_config_define_load(&defines, c);
if (ret) { if (!bret) {
lxc_container_put(c); lxc_container_put(c);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
...@@ -209,8 +209,8 @@ int main(int argc, char *argv[]) ...@@ -209,8 +209,8 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
ret = c->set_config_item(c, "lxc.init.uid", buf); bret = c->set_config_item(c, "lxc.init.uid", buf);
if (ret < 0) { if (!bret) {
lxc_container_put(c); lxc_container_put(c);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
...@@ -225,8 +225,8 @@ int main(int argc, char *argv[]) ...@@ -225,8 +225,8 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
ret = c->set_config_item(c, "lxc.init.gid", buf); bret = c->set_config_item(c, "lxc.init.gid", buf);
if (ret < 0) { if (!bret) {
lxc_container_put(c); lxc_container_put(c);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
......
...@@ -277,7 +277,7 @@ int main(int argc, char *argv[]) ...@@ -277,7 +277,7 @@ int main(int argc, char *argv[])
goto out; goto out;
} }
if (lxc_config_define_load(&defines, c)) if (!lxc_config_define_load(&defines, c))
goto out; goto out;
if (!rcfile && !strcmp("/sbin/init", args[0])) { if (!rcfile && !strcmp("/sbin/init", args[0])) {
......
...@@ -800,20 +800,20 @@ int lxc_config_define_add(struct lxc_list *defines, char *arg) ...@@ -800,20 +800,20 @@ int lxc_config_define_add(struct lxc_list *defines, char *arg)
return 0; return 0;
} }
int lxc_config_define_load(struct lxc_list *defines, struct lxc_container *c) bool lxc_config_define_load(struct lxc_list *defines, struct lxc_container *c)
{ {
struct lxc_list *it; struct lxc_list *it;
int ret = 0; bool bret = true;
lxc_list_for_each(it, defines) { lxc_list_for_each(it, defines) {
struct new_config_item *new_item = it->elem; struct new_config_item *new_item = it->elem;
ret = c->set_config_item(c, new_item->key, new_item->val); bret = c->set_config_item(c, new_item->key, new_item->val);
if (ret < 0) if (!bret)
break; break;
} }
lxc_config_define_free(defines); lxc_config_define_free(defines);
return ret; return bret;
} }
void lxc_config_define_free(struct lxc_list *defines) void lxc_config_define_free(struct lxc_list *defines)
......
...@@ -160,8 +160,8 @@ extern char *get_template_path(const char *t); ...@@ -160,8 +160,8 @@ extern char *get_template_path(const char *t);
extern bool switch_to_ns(pid_t pid, const char *ns); extern bool switch_to_ns(pid_t pid, const char *ns);
extern int lxc_config_define_add(struct lxc_list *defines, char *arg); extern int lxc_config_define_add(struct lxc_list *defines, char *arg);
extern int lxc_config_define_load(struct lxc_list *defines, extern bool lxc_config_define_load(struct lxc_list *defines,
struct lxc_container *c); struct lxc_container *c);
extern void lxc_config_define_free(struct lxc_list *defines); extern void lxc_config_define_free(struct lxc_list *defines);
extern int lxc_char_left_gc(const char *buffer, size_t len); extern int lxc_char_left_gc(const char *buffer, size_t len);
extern int lxc_char_right_gc(const char *buffer, size_t len); extern int lxc_char_right_gc(const char *buffer, size_t len);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment