[lxc-devel] [PATCH] Use autoconf LXCPATH instead of hardcoded LXCDIR
Stéphane Graber
stgraber at ubuntu.com
Tue Nov 27 15:07:18 UTC 2012
On 11/26/2012 03:57 PM, Dwight Engen wrote:
> 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>
Good catch.
Acked-by: Stéphane Graber <stgraber at ubuntu.com>
And pushed to staging.
> ---
> 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
>
--
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 899 bytes
Desc: OpenPGP digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20121127/d629ebdc/attachment.pgp>
More information about the lxc-devel
mailing list