tree-wide: improve logging

parent 4110345b
...@@ -325,7 +325,7 @@ static int lxc_attach_set_environment(struct lxc_proc_context_info *init_ctx, ...@@ -325,7 +325,7 @@ static int lxc_attach_set_environment(struct lxc_proc_context_info *init_ctx,
ret = putenv("container=lxc"); ret = putenv("container=lxc");
if (ret < 0) if (ret < 0)
return log_warn(-1, errno, "Failed to set environment variable"); return log_warn(-1, "Failed to set environment variable");
/* Set container environment variables.*/ /* Set container environment variables.*/
if (init_ctx && init_ctx->container && init_ctx->container->lxc_conf) { if (init_ctx && init_ctx->container && init_ctx->container->lxc_conf) {
......
...@@ -510,10 +510,10 @@ __lxc_unused static inline void LXC_##LEVEL(struct lxc_log_locinfo* locinfo, \ ...@@ -510,10 +510,10 @@ __lxc_unused static inline void LXC_##LEVEL(struct lxc_log_locinfo* locinfo, \
__ret__; \ __ret__; \
}) })
#define log_warn(__ret__, __errno__, format, ...) \ #define log_warn(__ret__, format, ...) \
({ \ ({ \
WARN(format, ##__VA_ARGS__); \ WARN(format, ##__VA_ARGS__); \
__ret__; \ __ret__; \
}) })
#define log_debug_errno(__ret__, __errno__, format, ...) \ #define log_debug_errno(__ret__, __errno__, format, ...) \
......
...@@ -94,9 +94,7 @@ static void print_top_failing_dir(const char *path) ...@@ -94,9 +94,7 @@ static void print_top_failing_dir(const char *path)
ret = access(copy, X_OK); ret = access(copy, X_OK);
if (ret != 0) { if (ret != 0) {
SYSERROR("Could not access %s. Please grant it x " SYSERROR("Could not access %s. Please grant it x access, or add an ACL for the container " "root", copy);
"access, or add an ACL for the container "
"root", copy);
return; return;
} }
*p = saved; *p = saved;
...@@ -105,14 +103,11 @@ static void print_top_failing_dir(const char *path) ...@@ -105,14 +103,11 @@ static void print_top_failing_dir(const char *path)
static void lxc_put_nsfds(struct lxc_handler *handler) static void lxc_put_nsfds(struct lxc_handler *handler)
{ {
int i; for (int i = 0; i < LXC_NS_MAX; i++) {
for (i = 0; i < LXC_NS_MAX; i++) {
if (handler->nsfd[i] < 0) if (handler->nsfd[i] < 0)
continue; continue;
close(handler->nsfd[i]); close_prot_errno_disarm(handler->nsfd[i]);
handler->nsfd[i] = -EBADF;
} }
} }
...@@ -122,13 +117,14 @@ static int lxc_try_preserve_ns(const int pid, const char *ns) ...@@ -122,13 +117,14 @@ static int lxc_try_preserve_ns(const int pid, const char *ns)
fd = lxc_preserve_ns(pid, ns); fd = lxc_preserve_ns(pid, ns);
if (fd < 0) { if (fd < 0) {
if (errno != ENOENT) { if (errno != ENOENT)
SYSERROR("Failed to preserve %s namespace", ns); return log_error_errno(-EINVAL,
return -EINVAL; errno, "Failed to preserve %s namespace",
} ns);
SYSWARN("Kernel does not support preserving %s namespaces", ns); return log_error_errno(-EOPNOTSUPP,
return -EOPNOTSUPP; errno, "Kernel does not support preserving %s namespaces",
ns);
} }
return fd; return fd;
...@@ -187,23 +183,18 @@ static bool match_dlog_fds(struct dirent *direntp) ...@@ -187,23 +183,18 @@ static bool match_dlog_fds(struct dirent *direntp)
int ret; int ret;
ret = snprintf(path, PATH_MAX, "/proc/self/fd/%s", direntp->d_name); ret = snprintf(path, PATH_MAX, "/proc/self/fd/%s", direntp->d_name);
if (ret < 0 || ret >= PATH_MAX) { if (ret < 0 || ret >= PATH_MAX)
ERROR("Failed to create file descriptor name"); return log_error(false, "Failed to create file descriptor name");
return false;
}
linklen = readlink(path, link, PATH_MAX); linklen = readlink(path, link, PATH_MAX);
if (linklen < 0) { if (linklen < 0)
SYSERROR("Failed to read link path - \"%s\"", path); return log_error(false, "Failed to read link path - \"%s\"", path);
return false; else if (linklen >= PATH_MAX)
} else if (linklen >= PATH_MAX) { return log_error(false, "The name of link path is too long - \"%s\"", path);
ERROR("The name of link path is too long - \"%s\"", path);
return false; if (strcmp(link, "/dev/log_main") == 0 ||
} strcmp(link, "/dev/log_system") == 0 ||
strcmp(link, "/dev/log_radio") == 0)
if (strcmp(link, "/dev/log_main") == 0 ||
strcmp(link, "/dev/log_system") == 0 ||
strcmp(link, "/dev/log_radio") == 0)
return true; return true;
return false; return false;
...@@ -223,10 +214,8 @@ int lxc_check_inherited(struct lxc_conf *conf, bool closeall, ...@@ -223,10 +214,8 @@ int lxc_check_inherited(struct lxc_conf *conf, bool closeall,
restart: restart:
dir = opendir("/proc/self/fd"); dir = opendir("/proc/self/fd");
if (!dir) { if (!dir)
SYSWARN("Failed to open directory"); return log_warn(-1, "Failed to open directory");
return -1;
}
fddir = dirfd(dir); fddir = dirfd(dir);
...@@ -319,16 +308,14 @@ static int setup_signal_fd(sigset_t *oldmask) ...@@ -319,16 +308,14 @@ static int setup_signal_fd(sigset_t *oldmask)
} }
ret = pthread_sigmask(SIG_BLOCK, &mask, oldmask); ret = pthread_sigmask(SIG_BLOCK, &mask, oldmask);
if (ret < 0) { if (ret < 0)
SYSERROR("Failed to set signal mask"); return log_error_errno(-EBADF, errno,
return -EBADF; "Failed to set signal mask");
}
ret = signalfd(-1, &mask, SFD_CLOEXEC); ret = signalfd(-1, &mask, SFD_CLOEXEC);
if (ret < 0) { if (ret < 0)
SYSERROR("Failed to create signal file descriptor"); return log_error_errno(-EBADF,
return -EBADF; errno, "Failed to create signal file descriptor");
}
TRACE("Created signal file descriptor %d", ret); TRACE("Created signal file descriptor %d", ret);
...@@ -344,15 +331,11 @@ static int signal_handler(int fd, uint32_t events, void *data, ...@@ -344,15 +331,11 @@ static int signal_handler(int fd, uint32_t events, void *data,
struct lxc_handler *hdlr = data; struct lxc_handler *hdlr = data;
ret = lxc_read_nointr(fd, &siginfo, sizeof(siginfo)); ret = lxc_read_nointr(fd, &siginfo, sizeof(siginfo));
if (ret < 0) { if (ret < 0)
ERROR("Failed to read signal info from signal file descriptor %d", fd); return log_error(LXC_MAINLOOP_ERROR, "Failed to read signal info from signal file descriptor %d", fd);
return LXC_MAINLOOP_ERROR;
}
if (ret != sizeof(siginfo)) { if (ret != sizeof(siginfo))
ERROR("Unexpected size for struct signalfd_siginfo"); return log_error(-EINVAL, "Unexpected size for struct signalfd_siginfo");
return -EINVAL;
}
/* Check whether init is running. */ /* Check whether init is running. */
info.si_pid = 0; info.si_pid = 0;
...@@ -425,9 +408,7 @@ static int signal_handler(int fd, uint32_t events, void *data, ...@@ -425,9 +408,7 @@ static int signal_handler(int fd, uint32_t events, void *data,
: LXC_MAINLOOP_CONTINUE; : LXC_MAINLOOP_CONTINUE;
} }
DEBUG("Container init process %d exited", hdlr->pid); return log_debug(LXC_MAINLOOP_CLOSE, "Container init process %d exited", hdlr->pid);
return LXC_MAINLOOP_CLOSE;
} }
int lxc_serve_state_clients(const char *name, struct lxc_handler *handler, int lxc_serve_state_clients(const char *name, struct lxc_handler *handler,
...@@ -445,10 +426,8 @@ int lxc_serve_state_clients(const char *name, struct lxc_handler *handler, ...@@ -445,10 +426,8 @@ int lxc_serve_state_clients(const char *name, struct lxc_handler *handler,
TRACE("Set container state to %s", lxc_state2str(state)); TRACE("Set container state to %s", lxc_state2str(state));
if (lxc_list_empty(&handler->conf->state_clients)) { if (lxc_list_empty(&handler->conf->state_clients))
TRACE("No state clients registered"); return log_trace(0, "No state clients registered");
return 0;
}
retlen = strlcpy(msg.name, name, sizeof(msg.name)); retlen = strlcpy(msg.name, name, sizeof(msg.name));
if (retlen >= sizeof(msg.name)) if (retlen >= sizeof(msg.name))
...@@ -507,17 +486,14 @@ again: ...@@ -507,17 +486,14 @@ again:
return -1; return -1;
} }
if (ret != sizeof(int)) { if (ret != sizeof(int))
ERROR("Message too long : %d", handler->state_socket_pair[1]); return log_error(-1, "Message too long : %d", handler->state_socket_pair[1]);
return -1;
}
TRACE("Sent container state \"%s\" to %d", lxc_state2str(state), TRACE("Sent container state \"%s\" to %d", lxc_state2str(state),
handler->state_socket_pair[1]); handler->state_socket_pair[1]);
/* Close write end of the socket pair. */ /* Close write end of the socket pair. */
close(handler->state_socket_pair[1]); close_prot_errno_disarm(handler->state_socket_pair[1]);
handler->state_socket_pair[1] = -1;
return 0; return 0;
} }
...@@ -528,10 +504,8 @@ int lxc_set_state(const char *name, struct lxc_handler *handler, ...@@ -528,10 +504,8 @@ int lxc_set_state(const char *name, struct lxc_handler *handler,
int ret; int ret;
ret = lxc_serve_state_socket_pair(name, handler, state); ret = lxc_serve_state_socket_pair(name, handler, state);
if (ret < 0) { if (ret < 0)
ERROR("Failed to synchronize via anonymous pair of unix sockets"); return log_error(-1, "Failed to synchronize via anonymous pair of unix sockets");
return -1;
}
ret = lxc_serve_state_clients(name, handler, state); ret = lxc_serve_state_clients(name, handler, state);
if (ret < 0) if (ret < 0)
...@@ -636,39 +610,37 @@ out_sigfd: ...@@ -636,39 +610,37 @@ out_sigfd:
void lxc_zero_handler(struct lxc_handler *handler) void lxc_zero_handler(struct lxc_handler *handler)
{ {
int i;
memset(handler, 0, sizeof(struct lxc_handler)); memset(handler, 0, sizeof(struct lxc_handler));
handler->pinfd = -1; handler->pinfd = -EBADF;
handler->pidfd = -EBADF; handler->pidfd = -EBADF;
handler->sigfd = -1; handler->sigfd = -EBADF;
for (i = 0; i < LXC_NS_MAX; i++) for (int i = 0; i < LXC_NS_MAX; i++)
handler->nsfd[i] = -1; handler->nsfd[i] = -EBADF;
handler->data_sock[0] = -1; handler->data_sock[0] = -EBADF;
handler->data_sock[1] = -1; handler->data_sock[1] = -EBADF;
handler->state_socket_pair[0] = -1; handler->state_socket_pair[0] = -EBADF;
handler->state_socket_pair[1] = -1; handler->state_socket_pair[1] = -EBADF;
handler->sync_sock[0] = -1; handler->sync_sock[0] = -EBADF;
handler->sync_sock[1] = -1; handler->sync_sock[1] = -EBADF;
} }
void lxc_free_handler(struct lxc_handler *handler) void lxc_free_handler(struct lxc_handler *handler)
{ {
if (handler->pinfd >= 0) if (handler->pinfd >= 0)
close(handler->pinfd); close_prot_errno_disarm(handler->pinfd);
if (handler->pidfd >= 0) if (handler->pidfd >= 0)
close(handler->pidfd); close_prot_errno_disarm(handler->pidfd);
if (handler->sigfd >= 0) if (handler->sigfd >= 0)
close(handler->sigfd); close_prot_errno_disarm(handler->sigfd);
lxc_put_nsfds(handler); lxc_put_nsfds(handler);
...@@ -677,26 +649,25 @@ void lxc_free_handler(struct lxc_handler *handler) ...@@ -677,26 +649,25 @@ void lxc_free_handler(struct lxc_handler *handler)
lxc_abstract_unix_close(handler->conf->maincmd_fd); lxc_abstract_unix_close(handler->conf->maincmd_fd);
if (handler->monitor_status_fd >= 0) if (handler->monitor_status_fd >= 0)
close(handler->monitor_status_fd); close_prot_errno_disarm(handler->monitor_status_fd);
if (handler->state_socket_pair[0] >= 0) if (handler->state_socket_pair[0] >= 0)
close(handler->state_socket_pair[0]); close_prot_errno_disarm(handler->state_socket_pair[0]);
if (handler->state_socket_pair[1] >= 0) if (handler->state_socket_pair[1] >= 0)
close(handler->state_socket_pair[1]); close_prot_errno_disarm(handler->state_socket_pair[1]);
if (handler->cgroup_ops) if (handler->cgroup_ops)
cgroup_exit(handler->cgroup_ops); cgroup_exit(handler->cgroup_ops);
handler->conf = NULL; handler->conf = NULL;
free(handler); free_disarm(handler);
handler = NULL;
} }
struct lxc_handler *lxc_init_handler(const char *name, struct lxc_conf *conf, struct lxc_handler *lxc_init_handler(const char *name, struct lxc_conf *conf,
const char *lxcpath, bool daemonize) const char *lxcpath, bool daemonize)
{ {
int i, ret; int ret;
struct lxc_handler *handler; struct lxc_handler *handler;
handler = malloc(sizeof(*handler)); handler = malloc(sizeof(*handler));
...@@ -710,20 +681,22 @@ struct lxc_handler *lxc_init_handler(const char *name, struct lxc_conf *conf, ...@@ -710,20 +681,22 @@ struct lxc_handler *lxc_init_handler(const char *name, struct lxc_conf *conf,
* as root so this should be fine. * as root so this should be fine.
*/ */
handler->am_root = !am_guest_unpriv(); handler->am_root = !am_guest_unpriv();
handler->data_sock[0] = handler->data_sock[1] = -1;
handler->conf = conf; handler->conf = conf;
handler->lxcpath = lxcpath; handler->lxcpath = lxcpath;
handler->init_died = false;
handler->data_sock[0] = -EBADF;
handler->data_sock[1] = -EBADF;
handler->monitor_status_fd = -EBADF; handler->monitor_status_fd = -EBADF;
handler->pinfd = -1; handler->pinfd = -EBADF;
handler->pidfd = -EBADF; handler->pidfd = -EBADF;
handler->sigfd = -EBADF; handler->sigfd = -EBADF;
handler->init_died = false; handler->state_socket_pair[0] = -EBADF;
handler->state_socket_pair[0] = handler->state_socket_pair[1] = -1; handler->state_socket_pair[1] = -EBADF;
if (handler->conf->reboot == REBOOT_NONE) if (handler->conf->reboot == REBOOT_NONE)
lxc_list_init(&handler->conf->state_clients); lxc_list_init(&handler->conf->state_clients);
for (i = 0; i < LXC_NS_MAX; i++) for (int i = 0; i < LXC_NS_MAX; i++)
handler->nsfd[i] = -1; handler->nsfd[i] = -EBADF;
handler->name = name; handler->name = name;
if (daemonize) if (daemonize)
...@@ -807,50 +780,43 @@ int lxc_init(const char *name, struct lxc_handler *handler) ...@@ -807,50 +780,43 @@ int lxc_init(const char *name, struct lxc_handler *handler)
if (conf->rcfile) { if (conf->rcfile) {
ret = setenv("LXC_CONFIG_FILE", conf->rcfile, 1); ret = setenv("LXC_CONFIG_FILE", conf->rcfile, 1);
if (ret < 0) if (ret < 0)
SYSERROR("Failed to set environment variable: " SYSERROR("Failed to set environment variable: LXC_CONFIG_FILE=%s", conf->rcfile);
"LXC_CONFIG_FILE=%s", conf->rcfile);
} }
if (conf->rootfs.mount) { if (conf->rootfs.mount) {
ret = setenv("LXC_ROOTFS_MOUNT", conf->rootfs.mount, 1); ret = setenv("LXC_ROOTFS_MOUNT", conf->rootfs.mount, 1);
if (ret < 0) if (ret < 0)
SYSERROR("Failed to set environment variable: " SYSERROR("Failed to set environment variable: LXC_ROOTFS_MOUNT=%s", conf->rootfs.mount);
"LXC_ROOTFS_MOUNT=%s", conf->rootfs.mount);
} }
if (conf->rootfs.path) { if (conf->rootfs.path) {
ret = setenv("LXC_ROOTFS_PATH", conf->rootfs.path, 1); ret = setenv("LXC_ROOTFS_PATH", conf->rootfs.path, 1);
if (ret < 0) if (ret < 0)
SYSERROR("Failed to set environment variable: " SYSERROR("Failed to set environment variable: LXC_ROOTFS_PATH=%s", conf->rootfs.path);
"LXC_ROOTFS_PATH=%s", conf->rootfs.path);
} }
if (conf->console.path) { if (conf->console.path) {
ret = setenv("LXC_CONSOLE", conf->console.path, 1); ret = setenv("LXC_CONSOLE", conf->console.path, 1);
if (ret < 0) if (ret < 0)
SYSERROR("Failed to set environment variable: " SYSERROR("Failed to set environment variable: LXC_CONSOLE=%s", conf->console.path);
"LXC_CONSOLE=%s", conf->console.path);
} }
if (conf->console.log_path) { if (conf->console.log_path) {
ret = setenv("LXC_CONSOLE_LOGPATH", conf->console.log_path, 1); ret = setenv("LXC_CONSOLE_LOGPATH", conf->console.log_path, 1);
if (ret < 0) if (ret < 0)
SYSERROR("Failed to set environment variable: " SYSERROR("Failed to set environment variable: LXC_CONSOLE_LOGPATH=%s", conf->console.log_path);
"LXC_CONSOLE_LOGPATH=%s", conf->console.log_path);
} }
if (cgns_supported()) { if (cgns_supported()) {
ret = setenv("LXC_CGNS_AWARE", "1", 1); ret = setenv("LXC_CGNS_AWARE", "1", 1);
if (ret < 0) if (ret < 0)
SYSERROR("Failed to set environment variable " SYSERROR("Failed to set environment variable LXC_CGNS_AWARE=1");
"LXC_CGNS_AWARE=1");
} }
loglevel = lxc_log_priority_to_string(lxc_log_get_level()); loglevel = lxc_log_priority_to_string(lxc_log_get_level());
ret = setenv("LXC_LOG_LEVEL", loglevel, 1); ret = setenv("LXC_LOG_LEVEL", loglevel, 1);
if (ret < 0) if (ret < 0)
SYSERROR("Set environment variable LXC_LOG_LEVEL=%s", SYSERROR("Set environment variable LXC_LOG_LEVEL=%s", loglevel);
loglevel);
if (conf->hooks_version == 0) if (conf->hooks_version == 0)
ret = setenv("LXC_HOOK_VERSION", "0", 1); ret = setenv("LXC_HOOK_VERSION", "0", 1);
...@@ -933,7 +899,7 @@ out_close_maincmd_fd: ...@@ -933,7 +899,7 @@ out_close_maincmd_fd:
void lxc_fini(const char *name, struct lxc_handler *handler) void lxc_fini(const char *name, struct lxc_handler *handler)
{ {
int i, ret; int ret;
pid_t self; pid_t self;
struct lxc_list *cur, *next; struct lxc_list *cur, *next;
char *namespaces[LXC_NS_MAX + 1]; char *namespaces[LXC_NS_MAX + 1];
...@@ -946,7 +912,7 @@ void lxc_fini(const char *name, struct lxc_handler *handler) ...@@ -946,7 +912,7 @@ void lxc_fini(const char *name, struct lxc_handler *handler)
lxc_set_state(name, handler, STOPPING); lxc_set_state(name, handler, STOPPING);
self = lxc_raw_getpid(); self = lxc_raw_getpid();
for (i = 0; i < LXC_NS_MAX; i++) { for (int i = 0; i < LXC_NS_MAX; i++) {
if (handler->nsfd[i] < 0) if (handler->nsfd[i] < 0)
continue; continue;
...@@ -957,7 +923,7 @@ void lxc_fini(const char *name, struct lxc_handler *handler) ...@@ -957,7 +923,7 @@ void lxc_fini(const char *name, struct lxc_handler *handler)
else else
ret = asprintf(&namespaces[namespace_count], ret = asprintf(&namespaces[namespace_count],
"/proc/%d/fd/%d", self, handler->nsfd[i]); "/proc/%d/fd/%d", self, handler->nsfd[i]);
if (ret == -1) { if (ret < 0) {
SYSERROR("Failed to allocate memory"); SYSERROR("Failed to allocate memory");
break; break;
} }
...@@ -982,15 +948,13 @@ void lxc_fini(const char *name, struct lxc_handler *handler) ...@@ -982,15 +948,13 @@ void lxc_fini(const char *name, struct lxc_handler *handler)
if (handler->conf->reboot > REBOOT_NONE) { if (handler->conf->reboot > REBOOT_NONE) {
ret = setenv("LXC_TARGET", "reboot", 1); ret = setenv("LXC_TARGET", "reboot", 1);
if (ret < 0) if (ret < 0)
SYSERROR("Failed to set environment variable: " SYSERROR("Failed to set environment variable: LXC_TARGET=reboot");
"LXC_TARGET=reboot");
} }
if (handler->conf->reboot == REBOOT_NONE) { if (handler->conf->reboot == REBOOT_NONE) {
ret = setenv("LXC_TARGET", "stop", 1); ret = setenv("LXC_TARGET", "stop", 1);
if (ret < 0) if (ret < 0)
SYSERROR("Failed to set environment variable: " SYSERROR("Failed to set environment variable: LXC_TARGET=stop");
"LXC_TARGET=stop");
} }
if (handler->conf->hooks_version == 0) if (handler->conf->hooks_version == 0)
...@@ -1018,7 +982,7 @@ void lxc_fini(const char *name, struct lxc_handler *handler) ...@@ -1018,7 +982,7 @@ void lxc_fini(const char *name, struct lxc_handler *handler)
* because we haven't yet closed the command socket. * because we haven't yet closed the command socket.
*/ */
lxc_abstract_unix_close(handler->conf->maincmd_fd); lxc_abstract_unix_close(handler->conf->maincmd_fd);
handler->conf->maincmd_fd = -1; handler->conf->maincmd_fd = -EBADF;
TRACE("Closed command socket"); TRACE("Closed command socket");
/* This function will try to connect to the legacy lxc-monitord /* This function will try to connect to the legacy lxc-monitord
...@@ -1047,8 +1011,7 @@ void lxc_fini(const char *name, struct lxc_handler *handler) ...@@ -1047,8 +1011,7 @@ void lxc_fini(const char *name, struct lxc_handler *handler)
ret = setenv("LXC_TARGET", "stop", 1); ret = setenv("LXC_TARGET", "stop", 1);
if (ret < 0) if (ret < 0)
WARN("Failed to set environment variable: " WARN("Failed to set environment variable: LXC_TARGET=stop");
"LXC_TARGET=stop");
} }
} }
...@@ -1251,9 +1214,7 @@ static int do_start(void *data) ...@@ -1251,9 +1214,7 @@ static int do_start(void *data)
if (devnull_fd < 0) if (devnull_fd < 0)
goto out_warn_father; goto out_warn_father;
WARN("Using /dev/null from the host for container " WARN("Using /dev/null from the host for container init's standard file descriptors. Migration will not work");
"init's standard file descriptors. Migration will "
"not work");
} }
} }
...@@ -1321,12 +1282,10 @@ static int do_start(void *data) ...@@ -1321,12 +1282,10 @@ static int do_start(void *data)
ret = prctl(PR_SET_NO_NEW_PRIVS, prctl_arg(1), prctl_arg(0), ret = prctl(PR_SET_NO_NEW_PRIVS, prctl_arg(1), prctl_arg(0),
prctl_arg(0), prctl_arg(0)); prctl_arg(0), prctl_arg(0));
if (ret < 0) { if (ret < 0) {
SYSERROR("Could not set PR_SET_NO_NEW_PRIVS to block " SYSERROR("Could not set PR_SET_NO_NEW_PRIVS to block execve() gainable privileges");
"execve() gainable privileges");
goto out_warn_father; goto out_warn_father;
} }
DEBUG("Set PR_SET_NO_NEW_PRIVS to block execve() gainable " DEBUG("Set PR_SET_NO_NEW_PRIVS to block execve() gainable privileges");
"privileges");
} }
/* Some init's such as busybox will set sane tty settings on stdin, /* Some init's such as busybox will set sane tty settings on stdin,
...@@ -1341,8 +1300,8 @@ static int do_start(void *data) ...@@ -1341,8 +1300,8 @@ static int do_start(void *data)
else else
ret = lxc_terminal_set_stdfds(handler->conf->console.slave); ret = lxc_terminal_set_stdfds(handler->conf->console.slave);
if (ret < 0) { if (ret < 0) {
ERROR("Failed to redirect std{in,out,err} to pty file " ERROR("Failed to redirect std{in,out,err} to pty file descriptor %d",
"descriptor %d", handler->conf->console.slave); handler->conf->console.slave);
goto out_warn_father; goto out_warn_father;
} }
} }
...@@ -1522,8 +1481,7 @@ static int lxc_recv_ttys_from_child(struct lxc_handler *handler) ...@@ -1522,8 +1481,7 @@ static int lxc_recv_ttys_from_child(struct lxc_handler *handler)
tty->busy = -1; tty->busy = -1;
tty->master = ttyfds[0]; tty->master = ttyfds[0];
tty->slave = ttyfds[1]; tty->slave = ttyfds[1];
TRACE("Received pty with master fd %d and slave fd %d from " TRACE("Received pty with master fd %d and slave fd %d from child", tty->master, tty->slave);
"child", tty->master, tty->slave);
} }
if (ret < 0) if (ret < 0)
...@@ -2072,8 +2030,7 @@ int __lxc_start(const char *name, struct lxc_handler *handler, ...@@ -2072,8 +2030,7 @@ int __lxc_start(const char *name, struct lxc_handler *handler,
ret = lxc_restore_phys_nics_to_netns(handler); ret = lxc_restore_phys_nics_to_netns(handler);
if (ret < 0) if (ret < 0)
ERROR("Failed to move physical network devices back to parent " ERROR("Failed to move physical network devices back to parent network namespace");
"network namespace");
if (handler->pinfd >= 0) { if (handler->pinfd >= 0) {
close(handler->pinfd); close(handler->pinfd);
......
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