[lxc-devel] [PATCH] rcfile shouldn't get set if the attempt to load a config file fails

S.Çağlar Onur caglar at 10ur.org
Wed Mar 27 19:06:57 UTC 2013


From: "S.Çağlar Onur" <caglar at 10ur.org>

Signed-off-by: S.Çağlar Onur <caglar at 10ur.org>
---
 src/lxc/confile.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/lxc/confile.c b/src/lxc/confile.c
index 8fe1541..16b8594 100644
--- a/src/lxc/confile.c
+++ b/src/lxc/confile.c
@@ -1422,11 +1422,13 @@ int lxc_config_readline(char *buffer, struct lxc_conf *conf)
 
 int lxc_config_read(const char *file, struct lxc_conf *conf)
 {
+	int ret = lxc_file_for_each_line(file, parse_line, conf);
+
 	/* Catch only the top level config file name in the structure */
-	if( ! conf->rcfile ) {
+	if( ret == 0 && ! conf->rcfile ) {
 		conf->rcfile = strdup( file );
 	}
-	return lxc_file_for_each_line(file, parse_line, conf);
+	return ret;
 }
 
 int lxc_config_define_add(struct lxc_list *defines, char* arg)
-- 
1.7.10.4





More information about the lxc-devel mailing list