lxccontainer: non-functional changes

parent 99979516
...@@ -617,6 +617,7 @@ static bool do_lxcapi_want_daemonize(struct lxc_container *c, bool state) ...@@ -617,6 +617,7 @@ static bool do_lxcapi_want_daemonize(struct lxc_container *c, bool state)
return false; return false;
c->daemonize = state; c->daemonize = state;
container_mem_unlock(c); container_mem_unlock(c);
return true; return true;
...@@ -633,6 +634,7 @@ static bool do_lxcapi_want_close_all_fds(struct lxc_container *c, bool state) ...@@ -633,6 +634,7 @@ static bool do_lxcapi_want_close_all_fds(struct lxc_container *c, bool state)
return false; return false;
c->lxc_conf->close_all_fds = state; c->lxc_conf->close_all_fds = state;
container_mem_unlock(c); container_mem_unlock(c);
return true; return true;
...@@ -656,8 +658,8 @@ WRAP_API_2(bool, lxcapi_wait, const char *, int) ...@@ -656,8 +658,8 @@ WRAP_API_2(bool, lxcapi_wait, const char *, int)
static bool am_single_threaded(void) static bool am_single_threaded(void)
{ {
struct dirent *direntp;
DIR *dir; DIR *dir;
struct dirent *direntp;
int count = 0; int count = 0;
dir = opendir("/proc/self/task"); dir = opendir("/proc/self/task");
...@@ -665,13 +667,14 @@ static bool am_single_threaded(void) ...@@ -665,13 +667,14 @@ static bool am_single_threaded(void)
return false; return false;
while ((direntp = readdir(dir))) { while ((direntp = readdir(dir))) {
if (!strcmp(direntp->d_name, ".")) if (strcmp(direntp->d_name, ".") == 0)
continue; continue;
if (!strcmp(direntp->d_name, "..")) if (strcmp(direntp->d_name, "..") == 0)
continue; continue;
if (++count > 1) count++;
if (count > 1)
break; break;
} }
closedir(dir); closedir(dir);
...@@ -684,9 +687,7 @@ static void push_arg(char ***argp, char *arg, int *nargs) ...@@ -684,9 +687,7 @@ static void push_arg(char ***argp, char *arg, int *nargs)
char *copy; char *copy;
char **argv; char **argv;
do { copy = must_copy_string(arg);
copy = strdup(arg);
} while (!copy);
do { do {
argv = realloc(*argp, (*nargs + 2) * sizeof(char *)); argv = realloc(*argp, (*nargs + 2) * sizeof(char *));
...@@ -844,11 +845,13 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a ...@@ -844,11 +845,13 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
if (container_mem_lock(c)) if (container_mem_lock(c))
return false; return false;
conf = c->lxc_conf; conf = c->lxc_conf;
daemonize = c->daemonize; daemonize = c->daemonize;
/* initialize handler */ /* initialize handler */
handler = lxc_init_handler(c->name, conf, c->config_path, daemonize); handler = lxc_init_handler(c->name, conf, c->config_path, daemonize);
container_mem_unlock(c); container_mem_unlock(c);
if (!handler) if (!handler)
return false; return false;
...@@ -905,9 +908,9 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a ...@@ -905,9 +908,9 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
* characters. All that it means is that the proctitle will be * characters. All that it means is that the proctitle will be
* ugly. Similarly, we also don't care if setproctitle() fails. * ugly. Similarly, we also don't care if setproctitle() fails.
* */ * */
snprintf(title, sizeof(title), "[lxc monitor] %s %s", c->config_path, c->name); (void)snprintf(title, sizeof(title), "[lxc monitor] %s %s", c->config_path, c->name);
INFO("Attempting to set proc title to %s", title); INFO("Attempting to set proc title to %s", title);
setproctitle(title); (void)setproctitle(title);
/* We fork() a second time to be reparented to init. Like /* We fork() a second time to be reparented to init. Like
* POSIX's daemon() function we change to "/" and redirect * POSIX's daemon() function we change to "/" and redirect
......
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