Store the container in the handler, so it is accessible
everywhere.
Signed-off-by: Daniel Lezcano <[email protected]>
---
src/lxc/start.c | 12 +++++++++++-
src/lxc/start.h | 1 +
2 files changed, 12 insertions(+), 1 deletion(-)
Index: lxc/src/lxc/start.c
===================================================================
--- lxc.orig/src/lxc/start.c
+++ lxc/src/lxc/start.c
@@ -196,10 +196,16 @@ struct lxc_handler *lxc_init(const char
handler->conf = conf;
+ handler->name = strdup(name);
+ if (!handler->name) {
+ ERROR("failed to allocate memory");
+ goto out_free;
+ }
+
/* Begin the set the state to STARTING*/
if (lxc_set_state(name, handler, STARTING)) {
ERROR("failed to set state '%s'", lxc_state2str(STARTING));
- goto out_free;
+ goto out_free_name;
}
if (lxc_create_tty(name, conf)) {
@@ -234,6 +240,9 @@ out_delete_tty:
lxc_delete_tty(&conf->tty_info);
out_aborting:
lxc_set_state(name, handler, ABORTING);
+out_free_name:
+ free(handler->name);
+ handler->name = NULL;
out_free:
free(handler);
return NULL;
@@ -249,6 +258,7 @@ void lxc_fini(const char *name, struct l
lxc_unlink_nsgroup(name);
lxc_delete_tty(&handler->conf->tty_info);
+ free(handler->name);
free(handler);
LXC_TTY_DEL_HANDLER(SIGQUIT);
Index: lxc/src/lxc/start.h
===================================================================
--- lxc.orig/src/lxc/start.h
+++ lxc/src/lxc/start.h
@@ -30,6 +30,7 @@ struct lxc_conf;
struct lxc_handler {
pid_t pid;
+ char *name;
lxc_state_t state;
int sigfd;
char nsgroup[MAXPATHLEN];
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Lxc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lxc-devel