1 From fb259e5b431260c61a2afcee862f7e836d7d8cf9 Mon Sep 17 00:00:00 2001
2 From: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 Date: Fri, 12 Aug 2016 14:49:37 +0200
4 Subject: [PATCH 2/3] tools: set configfile after load_config
6 In order to cause c->is_defined() to become true.
8 Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
10 src/lxc/tools/lxc_attach.c | 6 ++++++
11 src/lxc/tools/lxc_cgroup.c | 6 ++++++
12 src/lxc/tools/lxc_checkpoint.c | 6 ++++++
13 src/lxc/tools/lxc_console.c | 6 ++++++
14 src/lxc/tools/lxc_copy.c | 5 +++++
15 src/lxc/tools/lxc_destroy.c | 6 ++++++
16 src/lxc/tools/lxc_device.c | 5 +++++
17 src/lxc/tools/lxc_freeze.c | 6 ++++++
18 src/lxc/tools/lxc_info.c | 6 ++++++
19 src/lxc/tools/lxc_snapshot.c | 6 ++++++
20 src/lxc/tools/lxc_stop.c | 5 +++++
21 src/lxc/tools/lxc_unfreeze.c | 6 ++++++
22 src/lxc/tools/lxc_wait.c | 6 ++++++
23 13 files changed, 75 insertions(+)
25 diff --git a/src/lxc/tools/lxc_attach.c b/src/lxc/tools/lxc_attach.c
26 index 14c724a..e436ae9 100644
27 --- a/src/lxc/tools/lxc_attach.c
28 +++ b/src/lxc/tools/lxc_attach.c
29 @@ -384,6 +384,12 @@ int main(int argc, char *argv[])
33 + c->configfile = strdup(my_args.rcfile);
34 + if (!c->configfile) {
35 + ERROR("Out of memory setting new config filename");
36 + lxc_container_put(c);
41 if (!c->may_control(c)) {
42 diff --git a/src/lxc/tools/lxc_cgroup.c b/src/lxc/tools/lxc_cgroup.c
43 index c644501..4dc2682 100644
44 --- a/src/lxc/tools/lxc_cgroup.c
45 +++ b/src/lxc/tools/lxc_cgroup.c
46 @@ -92,6 +92,12 @@ int main(int argc, char *argv[])
50 + c->configfile = strdup(my_args.rcfile);
51 + if (!c->configfile) {
52 + ERROR("Out of memory setting new config filename");
53 + lxc_container_put(c);
58 if (!c->may_control(c)) {
59 diff --git a/src/lxc/tools/lxc_checkpoint.c b/src/lxc/tools/lxc_checkpoint.c
60 index bc18b80..6de3d23 100644
61 --- a/src/lxc/tools/lxc_checkpoint.c
62 +++ b/src/lxc/tools/lxc_checkpoint.c
63 @@ -222,6 +222,12 @@ int main(int argc, char *argv[])
67 + c->configfile = strdup(my_args.rcfile);
68 + if (!c->configfile) {
69 + fprintf(stderr, "Out of memory setting new config filename\n");
70 + lxc_container_put(c);
75 if (!c->may_control(c)) {
76 diff --git a/src/lxc/tools/lxc_console.c b/src/lxc/tools/lxc_console.c
77 index 8a4d1c0..829c908 100644
78 --- a/src/lxc/tools/lxc_console.c
79 +++ b/src/lxc/tools/lxc_console.c
80 @@ -120,6 +120,12 @@ int main(int argc, char *argv[])
84 + c->configfile = strdup(my_args.rcfile);
85 + if (!c->configfile) {
86 + fprintf(stderr, "Out of memory setting new config filename\n");
87 + lxc_container_put(c);
92 if (!c->may_control(c)) {
93 diff --git a/src/lxc/tools/lxc_copy.c b/src/lxc/tools/lxc_copy.c
94 index c81c077..f7dc8b2 100644
95 --- a/src/lxc/tools/lxc_copy.c
96 +++ b/src/lxc/tools/lxc_copy.c
97 @@ -217,6 +217,11 @@ int main(int argc, char *argv[])
98 fprintf(stderr, "Failed to load rcfile\n");
101 + c->configfile = strdup(my_args.rcfile);
102 + if (!c->configfile) {
103 + fprintf(stderr, "Out of memory setting new config filename\n");
108 if (!c->may_control(c)) {
109 diff --git a/src/lxc/tools/lxc_destroy.c b/src/lxc/tools/lxc_destroy.c
110 index 50fd708..3f46415 100644
111 --- a/src/lxc/tools/lxc_destroy.c
112 +++ b/src/lxc/tools/lxc_destroy.c
113 @@ -96,6 +96,12 @@ int main(int argc, char *argv[])
114 lxc_container_put(c);
117 + c->configfile = strdup(my_args.rcfile);
118 + if (!c->configfile) {
119 + fprintf(stderr, "Out of memory setting new config filename\n");
120 + lxc_container_put(c);
121 + exit(EXIT_FAILURE);
125 if (!c->may_control(c)) {
126 diff --git a/src/lxc/tools/lxc_device.c b/src/lxc/tools/lxc_device.c
127 index 0f1ee8b..49af062 100644
128 --- a/src/lxc/tools/lxc_device.c
129 +++ b/src/lxc/tools/lxc_device.c
130 @@ -132,6 +132,11 @@ int main(int argc, char *argv[])
131 ERROR("Failed to load rcfile");
134 + c->configfile = strdup(my_args.rcfile);
135 + if (!c->configfile) {
136 + ERROR("Out of memory setting new config filename");
141 if (!c->is_running(c)) {
142 diff --git a/src/lxc/tools/lxc_freeze.c b/src/lxc/tools/lxc_freeze.c
143 index d0239bf..ac0802e 100644
144 --- a/src/lxc/tools/lxc_freeze.c
145 +++ b/src/lxc/tools/lxc_freeze.c
146 @@ -82,6 +82,12 @@ int main(int argc, char *argv[])
147 lxc_container_put(c);
150 + c->configfile = strdup(my_args.rcfile);
151 + if (!c->configfile) {
152 + ERROR("Out of memory setting new config filename");
153 + lxc_container_put(c);
158 if (!c->may_control(c)) {
159 diff --git a/src/lxc/tools/lxc_info.c b/src/lxc/tools/lxc_info.c
160 index e833697..08c698d 100644
161 --- a/src/lxc/tools/lxc_info.c
162 +++ b/src/lxc/tools/lxc_info.c
163 @@ -303,6 +303,12 @@ static int print_info(const char *name, const char *lxcpath)
164 lxc_container_put(c);
167 + c->configfile = strdup(my_args.rcfile);
168 + if (!c->configfile) {
169 + fprintf(stderr, "Out of memory setting new config filename\n");
170 + lxc_container_put(c);
175 if (!c->may_control(c)) {
176 diff --git a/src/lxc/tools/lxc_snapshot.c b/src/lxc/tools/lxc_snapshot.c
177 index aa9b6fe..a1166bc 100644
178 --- a/src/lxc/tools/lxc_snapshot.c
179 +++ b/src/lxc/tools/lxc_snapshot.c
180 @@ -115,6 +115,12 @@ int main(int argc, char *argv[])
181 lxc_container_put(c);
184 + c->configfile = strdup(my_args.rcfile);
185 + if (!c->configfile) {
186 + fprintf(stderr, "Out of memory setting new config filename\n");
187 + lxc_container_put(c);
188 + exit(EXIT_FAILURE);
192 if (!c->may_control(c)) {
193 diff --git a/src/lxc/tools/lxc_stop.c b/src/lxc/tools/lxc_stop.c
194 index bbe1f1c..cb7cfe2 100644
195 --- a/src/lxc/tools/lxc_stop.c
196 +++ b/src/lxc/tools/lxc_stop.c
197 @@ -210,6 +210,11 @@ int main(int argc, char *argv[])
198 fprintf(stderr, "Failed to load rcfile\n");
201 + c->configfile = strdup(my_args.rcfile);
202 + if (!c->configfile) {
203 + fprintf(stderr, "Out of memory setting new config filename\n");
208 if (!c->may_control(c)) {
209 diff --git a/src/lxc/tools/lxc_unfreeze.c b/src/lxc/tools/lxc_unfreeze.c
210 index b7bbea6..24faf5e 100644
211 --- a/src/lxc/tools/lxc_unfreeze.c
212 +++ b/src/lxc/tools/lxc_unfreeze.c
213 @@ -86,6 +86,12 @@ int main(int argc, char *argv[])
214 lxc_container_put(c);
217 + c->configfile = strdup(my_args.rcfile);
218 + if (!c->configfile) {
219 + ERROR("Out of memory setting new config filename");
220 + lxc_container_put(c);
225 if (!c->unfreeze(c)) {
226 diff --git a/src/lxc/tools/lxc_wait.c b/src/lxc/tools/lxc_wait.c
227 index deeff98..61fd869 100644
228 --- a/src/lxc/tools/lxc_wait.c
229 +++ b/src/lxc/tools/lxc_wait.c
230 @@ -112,6 +112,12 @@ int main(int argc, char *argv[])
231 lxc_container_put(c);
234 + c->configfile = strdup(my_args.rcfile);
235 + if (!c->configfile) {
236 + fprintf(stderr, "Out of memory setting new config filename\n");
237 + lxc_container_put(c);
242 if (!c->wait(c, my_args.states, my_args.timeout)) {