argv[j] = NULL;
}
- c->want_daemonize(c);
+ c->want_daemonize(c, true);
lua_pushboolean(L, !!c->start(c, useinit, argv));
return 1;
}
}
if (my_args.daemonize) {
- c->want_daemonize(c);
+ c->want_daemonize(c, true);
}
if (pid_fp != NULL) {
}
if (my_args.close_all_fds)
- c->want_close_all_fds(c);
+ c->want_close_all_fds(c, true);
err = c->start(c, 0, args) ? 0 : -1;
return ret;
}
-static void lxcapi_want_daemonize(struct lxc_container *c)
+static bool lxcapi_want_daemonize(struct lxc_container *c, bool state)
{
if (!c || !c->lxc_conf)
- return;
+ return false;
if (container_mem_lock(c)) {
ERROR("Error getting mem lock");
- return;
+ return false;
}
- c->daemonize = 1;
+ c->daemonize = state;
/* daemonize implies close_all_fds so set it */
- c->lxc_conf->close_all_fds = 1;
+ if (state == 1)
+ c->lxc_conf->close_all_fds = 1;
container_mem_unlock(c);
+ return true;
}
-static bool lxcapi_want_close_all_fds(struct lxc_container *c)
+static bool lxcapi_want_close_all_fds(struct lxc_container *c, bool state)
{
if (!c || !c->lxc_conf)
return false;
ERROR("Error getting mem lock");
return false;
}
- c->lxc_conf->close_all_fds = 1;
+ c->lxc_conf->close_all_fds = state;
container_mem_unlock(c);
return true;
}
{
int ret;
struct lxc_conf *conf;
- int daemonize = 0;
+ bool daemonize = false;
char *default_args[] = {
"/sbin/init",
'\0',
int error_num;
/*! Whether container wishes to be daemonized */
- int daemonize;
+ bool daemonize;
/*! Full path to configuration file */
char *config_path;
*
* \return \c true if container wants to be daemonised, else \c false.
*/
- void (*want_daemonize)(struct lxc_container *c);
+ bool (*want_daemonize)(struct lxc_container *c, bool state);
/*!
* \brief Determine whether container wishes all file descriptors
* \return \c true if container wants all file descriptors closed,
* else \c false.
*/
- bool (*want_close_all_fds)(struct lxc_container *c);
+ bool (*want_close_all_fds)(struct lxc_container *c, bool state);
/*!
* \brief Return current config file name.
}
if (close_fds && close_fds == Py_True) {
- self->container->want_close_all_fds(self->container);
+ self->container->want_close_all_fds(self->container, true);
+ }
+ else {
+ self->container->want_close_all_fds(self->container, false);
}
if (!daemonize || daemonize == Py_True) {
- self->container->want_daemonize(self->container);
+ self->container->want_daemonize(self->container, true);
+ }
+ else {
+ self->container->want_daemonize(self->container, false);
}
if (self->container->start(self->container, init_useinit, init_args))
if (lsm_enabled())
test_attach_lsm_set_config(ct);
- ct->want_daemonize(ct);
+ ct->want_daemonize(ct, true);
if (!ct->startl(ct, 0, NULL)) {
TSTERR("starting container %s", name);
goto out2;
goto out2;
}
c->load_config(c, NULL);
- c->want_daemonize(c);
+ c->want_daemonize(c, true);
if (!c->startl(c, 0, NULL)) {
TSTERR("starting container %s", name);
goto out3;
}
} else if(strcmp(args->mode, "start") == 0) {
if (c->is_defined(c) && !c->is_running(c)) {
- c->want_daemonize(c);
+ c->want_daemonize(c, true);
if (!c->start(c, false, NULL)) {
fprintf(stderr, "Starting the container (%s) failed...\n", name);
goto out;
c->load_config(c, NULL);
c->set_config_item(c, "lxc.tty", TTYCNT_STR);
c->save_config(c, NULL);
- c->want_daemonize(c);
+ c->want_daemonize(c, true);
if (!c->startl(c, 0, NULL)) {
TSTERR("starting container %s", name);
goto out3;
goto out;
/* non-daemonized is tested in 'startone' */
- c->want_daemonize(c);
+ c->want_daemonize(c, true);
if (!c->startl(c, 0, NULL, NULL)) {
fprintf(stderr, "%d: %s failed to start daemonized\n", __LINE__, c->name);
goto out;
}
c->load_config(c, NULL);
- c->want_daemonize(c);
+ c->want_daemonize(c, true);
if (!c->startl(c, 0, NULL)) {
fprintf(stderr, "%d: failed to start %s\n", __LINE__, MYNAME);
goto out;
}
c->load_config(c, NULL);
- c->want_daemonize(c);
+ c->want_daemonize(c, true);
if (!c->startl(c, 0, NULL)) {
fprintf(stderr, "%d: failed to start %s\n", __LINE__, MYNAME);
goto out;