tools: set configfile after load_config

In order to cause c->is_defined() to become true.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2016-08-12 14:49:37 +02:00
parent 50b737a3c6
commit 6118210e0a
13 changed files with 75 additions and 0 deletions

View File

@ -385,6 +385,12 @@ int main(int argc, char *argv[])
lxc_container_put(c); lxc_container_put(c);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
c->configfile = strdup(my_args.rcfile);
if (!c->configfile) {
ERROR("Out of memory setting new config filename");
lxc_container_put(c);
exit(EXIT_FAILURE);
}
} }
if (!c->may_control(c)) { if (!c->may_control(c)) {

View File

@ -92,6 +92,12 @@ int main(int argc, char *argv[])
lxc_container_put(c); lxc_container_put(c);
return 1; return 1;
} }
c->configfile = strdup(my_args.rcfile);
if (!c->configfile) {
ERROR("Out of memory setting new config filename");
lxc_container_put(c);
return 1;
}
} }
if (!c->may_control(c)) { if (!c->may_control(c)) {

View File

@ -222,6 +222,12 @@ int main(int argc, char *argv[])
lxc_container_put(c); lxc_container_put(c);
exit(1); exit(1);
} }
c->configfile = strdup(my_args.rcfile);
if (!c->configfile) {
fprintf(stderr, "Out of memory setting new config filename\n");
lxc_container_put(c);
exit(1);
}
} }
if (!c->may_control(c)) { if (!c->may_control(c)) {

View File

@ -120,6 +120,12 @@ int main(int argc, char *argv[])
lxc_container_put(c); lxc_container_put(c);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
c->configfile = strdup(my_args.rcfile);
if (!c->configfile) {
fprintf(stderr, "Out of memory setting new config filename\n");
lxc_container_put(c);
exit(EXIT_FAILURE);
}
} }
if (!c->may_control(c)) { if (!c->may_control(c)) {

View File

@ -217,6 +217,11 @@ int main(int argc, char *argv[])
fprintf(stderr, "Failed to load rcfile\n"); fprintf(stderr, "Failed to load rcfile\n");
goto out; goto out;
} }
c->configfile = strdup(my_args.rcfile);
if (!c->configfile) {
fprintf(stderr, "Out of memory setting new config filename\n");
goto out;
}
} }
if (!c->may_control(c)) { if (!c->may_control(c)) {

View File

@ -96,6 +96,12 @@ int main(int argc, char *argv[])
lxc_container_put(c); lxc_container_put(c);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
c->configfile = strdup(my_args.rcfile);
if (!c->configfile) {
fprintf(stderr, "Out of memory setting new config filename\n");
lxc_container_put(c);
exit(EXIT_FAILURE);
}
} }
if (!c->may_control(c)) { if (!c->may_control(c)) {

View File

@ -132,6 +132,11 @@ int main(int argc, char *argv[])
ERROR("Failed to load rcfile"); ERROR("Failed to load rcfile");
goto err1; goto err1;
} }
c->configfile = strdup(my_args.rcfile);
if (!c->configfile) {
ERROR("Out of memory setting new config filename");
goto err1;
}
} }
if (!c->is_running(c)) { if (!c->is_running(c)) {

View File

@ -82,6 +82,12 @@ int main(int argc, char *argv[])
lxc_container_put(c); lxc_container_put(c);
exit(1); exit(1);
} }
c->configfile = strdup(my_args.rcfile);
if (!c->configfile) {
ERROR("Out of memory setting new config filename");
lxc_container_put(c);
exit(1);
}
} }
if (!c->may_control(c)) { if (!c->may_control(c)) {

View File

@ -303,6 +303,12 @@ static int print_info(const char *name, const char *lxcpath)
lxc_container_put(c); lxc_container_put(c);
return -1; return -1;
} }
c->configfile = strdup(my_args.rcfile);
if (!c->configfile) {
fprintf(stderr, "Out of memory setting new config filename\n");
lxc_container_put(c);
return -1;
}
} }
if (!c->may_control(c)) { if (!c->may_control(c)) {

View File

@ -115,6 +115,12 @@ int main(int argc, char *argv[])
lxc_container_put(c); lxc_container_put(c);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
c->configfile = strdup(my_args.rcfile);
if (!c->configfile) {
fprintf(stderr, "Out of memory setting new config filename\n");
lxc_container_put(c);
exit(EXIT_FAILURE);
}
} }
if (!c->may_control(c)) { if (!c->may_control(c)) {

View File

@ -210,6 +210,11 @@ int main(int argc, char *argv[])
fprintf(stderr, "Failed to load rcfile\n"); fprintf(stderr, "Failed to load rcfile\n");
goto out; goto out;
} }
c->configfile = strdup(my_args.rcfile);
if (!c->configfile) {
fprintf(stderr, "Out of memory setting new config filename\n");
goto out;
}
} }
if (!c->may_control(c)) { if (!c->may_control(c)) {

View File

@ -86,6 +86,12 @@ int main(int argc, char *argv[])
lxc_container_put(c); lxc_container_put(c);
exit(1); exit(1);
} }
c->configfile = strdup(my_args.rcfile);
if (!c->configfile) {
ERROR("Out of memory setting new config filename");
lxc_container_put(c);
exit(1);
}
} }
if (!c->unfreeze(c)) { if (!c->unfreeze(c)) {

View File

@ -112,6 +112,12 @@ int main(int argc, char *argv[])
lxc_container_put(c); lxc_container_put(c);
return 1; return 1;
} }
c->configfile = strdup(my_args.rcfile);
if (!c->configfile) {
fprintf(stderr, "Out of memory setting new config filename\n");
lxc_container_put(c);
return 1;
}
} }
if (!c->wait(c, my_args.states, my_args.timeout)) { if (!c->wait(c, my_args.states, my_args.timeout)) {