coverity: #1425862

initialize handler Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent d9f8e1b7
......@@ -1147,6 +1147,8 @@ static bool do_dump(struct lxc_container *c, char *mode, struct migrate_opts *op
close(criuout[0]);
lxc_zero_handler(&h);
h.name = c->name;
if (!cgroup_init(&h)) {
ERROR("failed to cgroup_init()");
......
......@@ -509,6 +509,31 @@ out_sigfd:
return -1;
}
void lxc_zero_handler(struct lxc_handler *handler)
{
int i;
memset(handler, 0, sizeof(struct lxc_handler));
handler->clone_flags = -1;
handler->pinfd = -1;
handler->sigfd = -1;
for (i = 0; i < LXC_NS_MAX; i++)
handler->nsfd[i] = -1;
handler->data_sock[0] = -1;
handler->data_sock[1] = -1;
handler->state_socket_pair[0] = -1;
handler->state_socket_pair[1] = -1;
handler->sync_sock[0] = -1;
handler->sync_sock[1] = -1;
}
void lxc_free_handler(struct lxc_handler *handler)
{
if (handler->conf && handler->conf->maincmd_fd)
......
......@@ -125,6 +125,7 @@ extern struct lxc_handler *lxc_init_handler(const char *name,
struct lxc_conf *conf,
const char *lxcpath,
bool daemonize);
extern void lxc_zero_handler(struct lxc_handler *handler);
extern void lxc_free_handler(struct lxc_handler *handler);
extern int lxc_init(const char *name, struct lxc_handler *handler);
extern void lxc_fini(const char *name, struct lxc_handler *handler);
......
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