Commit c8ad5f46 by Serge Hallyn Committed by Stéphane Graber

api change: default container->daemonize to true

Pretty much the only case where we do NOT want to daemonize a container start is lxc-start. So make c->daemonize true by default, and have lxc-start set it to false. If there are existing API users who rely on daemonize by default, then they will be broken by this. It seems we should do this before beta1 if we're going to do it. Signed-off-by: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com> Acked-by: 's avatarStéphane Graber <stgraber@ubuntu.com>
parent 4213a747
...@@ -325,8 +325,8 @@ int main(int argc, char *argv[]) ...@@ -325,8 +325,8 @@ int main(int argc, char *argv[])
conf->inherit_ns_fd[i] = fd; conf->inherit_ns_fd[i] = fd;
} }
if (my_args.daemonize) { if (!my_args.daemonize) {
c->want_daemonize(c, true); c->want_daemonize(c, false);
} }
if (pid_fp != NULL) { if (pid_fp != NULL) {
......
...@@ -3052,6 +3052,7 @@ struct lxc_container *lxc_container_new(const char *name, const char *configpath ...@@ -3052,6 +3052,7 @@ struct lxc_container *lxc_container_new(const char *name, const char *configpath
lxcapi_destroy(c); lxcapi_destroy(c);
lxcapi_clear_config(c); lxcapi_clear_config(c);
} }
c->daemonize = true;
// assign the member functions // assign the member functions
c->is_defined = lxcapi_is_defined; c->is_defined = lxcapi_is_defined;
......
...@@ -168,6 +168,7 @@ int main(int argc, char *argv[]) ...@@ -168,6 +168,7 @@ int main(int argc, char *argv[])
fprintf(stderr, "%d: failed to get extra ref to container\n", __LINE__); fprintf(stderr, "%d: failed to get extra ref to container\n", __LINE__);
exit(1); exit(1);
} }
c->want_daemonize(false);
pid_t pid = fork(); pid_t pid = fork();
if (pid < 0) { if (pid < 0) {
fprintf(stderr, "%d: fork failed\n", __LINE__); fprintf(stderr, "%d: fork failed\n", __LINE__);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment