static rettype fnname(struct lxc_container *c) \
{ \
rettype ret; \
- current_config = c ? c->lxc_conf : NULL; \
+ bool reset_config = false; \
+ \
+ if (!current_config && c && c->lxc_conf) { \
+ current_config = c->lxc_conf; \
+ reset_config = true; \
+ } \
+ \
ret = do_##fnname(c); \
- current_config = NULL; \
+ if (reset_config) \
+ current_config = NULL; \
+ \
return ret; \
}
static rettype fnname(struct lxc_container *c, t1 a1) \
{ \
rettype ret; \
- current_config = c ? c->lxc_conf : NULL; \
+ bool reset_config = false; \
+ \
+ if (!current_config && c && c->lxc_conf) { \
+ current_config = c->lxc_conf; \
+ reset_config = true; \
+ } \
+ \
ret = do_##fnname(c, a1); \
- current_config = NULL; \
+ if (reset_config) \
+ current_config = NULL; \
+ \
return ret; \
}
static rettype fnname(struct lxc_container *c, t1 a1, t2 a2) \
{ \
rettype ret; \
- current_config = c ? c->lxc_conf : NULL; \
+ bool reset_config = false; \
+ \
+ if (!current_config && c && c->lxc_conf) { \
+ current_config = c->lxc_conf; \
+ reset_config = true; \
+ } \
+ \
ret = do_##fnname(c, a1, a2); \
- current_config = NULL; \
+ if (reset_config) \
+ current_config = NULL; \
+ \
return ret; \
}
static rettype fnname(struct lxc_container *c, t1 a1, t2 a2, t3 a3) \
{ \
rettype ret; \
- current_config = c ? c->lxc_conf : NULL; \
+ bool reset_config = false; \
+ \
+ if (!current_config && c && c->lxc_conf) { \
+ current_config = c->lxc_conf; \
+ reset_config = true; \
+ } \
+ \
ret = do_##fnname(c, a1, a2, a3); \
- current_config = NULL; \
+ if (reset_config) \
+ current_config = NULL; \
+ \
return ret; \
}