[prev in list] [next in list] [prev in thread] [next in thread]
List: lxc-devel
Subject: [lxc-devel] [patch 6/7] Add variables resolution info config file
From: nightnord () gmail ! com (Andrian Nord)
Date: 2009-12-07 10:52:22
Message-ID: 20091207105222.GH2452 () nord ! niifaq ! ru
[Download RAW message or body]
This relies on config.include patch, as it's itroducing parsing state,
but it's not nessesary for operation
Signed-off-by: Andrian Nord <NightNord at gmail.com>
diff --git a/src/lxc/confile.c b/src/lxc/confile.c
index 7b954b1..ed3fc63 100644
--- a/src/lxc/confile.c
+++ b/src/lxc/confile.c
@@ -35,6 +35,7 @@
#include "config.h"
#include "parse.h"
+#include "variables.h"
#include <lxc/log.h>
#include <lxc/conf.h>
@@ -571,7 +585,9 @@ static int parse_line(void *buffer, void *data)
char *line = buffer;
char *dot;
char *key;
- char *value;
+ char *value, *expanded;
+
+ int ret;
if (lxc_is_line_empty(line))
return 0;
@@ -601,7 +617,16 @@ static int parse_line(void *buffer, void *data)
return -1;
}
- return config->cb(key, value, state->lxc_conf);
+ if (lxc_resolve_variables(value, &expanded, state->lxc_conf)) {
+ ERROR("%s: variable resolution failed", state->file);
+ return -1;
+ }
+
+ ret = config->cb(key, expanded, state->lxc_conf);
+
+ free(expanded);
+
+ return ret;
}
int lxc_config_read(const char *file, struct lxc_conf *conf)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic