[lxc-devel] [PATCH] Use autoconf LXCPATH instead of hardcoded LXCDIR
Dwight Engen
dwight.engen at oracle.com
Mon Nov 26 20:57:53 UTC 2012
LXCDIR is only used in lxc_container_new, whereas LXCPATH is used throughout
the rest of lxc, and even in the same file as lxc_container_new (for example
create_container_dir()).
Signed-off-by: Dwight Engen <dwight.engen at oracle.com>
---
src/lxc/lxccontainer.c | 6 +++---
src/lxc/lxccontainer.h | 1 -
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
index ed2c483..cc91e05 100644
--- a/src/lxc/lxccontainer.c
+++ b/src/lxc/lxccontainer.c
@@ -882,13 +882,13 @@ struct lxc_container *lxc_container_new(char *name)
goto err;
}
- len = strlen(LXCDIR)+strlen(c->name)+strlen("/config")+2;
+ len = strlen(LXCPATH)+strlen(c->name)+strlen("/config")+2;
c->configfile = malloc(len);
if (!c->configfile) {
fprintf(stderr, "Error allocating config file pathname\n");
goto err;
}
- ret = snprintf(c->configfile, len, "%s/%s/config", LXCDIR, c->name);
+ ret = snprintf(c->configfile, len, "%s/%s/config", LXCPATH, c->name);
if (ret < 0 || ret >= len) {
fprintf(stderr, "Error printing out config file name\n");
goto err;
@@ -928,7 +928,7 @@ struct lxc_container *lxc_container_new(char *name)
}
/*
- * default configuration file is $LXCDIR/$NAME/config
+ * default configuration file is $LXCPATH/$NAME/config
*/
return c;
diff --git a/src/lxc/lxccontainer.h b/src/lxc/lxccontainer.h
index cad31ee..9e4267a 100644
--- a/src/lxc/lxccontainer.h
+++ b/src/lxc/lxccontainer.h
@@ -18,7 +18,6 @@ struct lxc_container {
int error_num;
int daemonize;
-#define LXCDIR "/var/lib/lxc"
bool (*is_defined)(struct lxc_container *c); // did /var/lib/lxc/$name/config exist
const char *(*state)(struct lxc_container *c);
bool (*is_running)(struct lxc_container *c); // true so long as defined and not stopped
--
1.7.1
More information about the lxc-devel
mailing list