Commit 0ecf64b5 by Serge Hallyn

initialize stopped at top of lxc_cmd

and don't do it at all the callers Signed-off-by: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com>
parent 814928c8
...@@ -247,6 +247,8 @@ static int lxc_cmd(const char *name, struct lxc_cmd_rr *cmd, int *stopped, ...@@ -247,6 +247,8 @@ static int lxc_cmd(const char *name, struct lxc_cmd_rr *cmd, int *stopped,
int len; int len;
int stay_connected = cmd->req.cmd == LXC_CMD_CONSOLE; int stay_connected = cmd->req.cmd == LXC_CMD_CONSOLE;
*stopped = 0;
len = sizeof(path)-1; len = sizeof(path)-1;
if (fill_sock_name(offset, len, name, lxcpath)) if (fill_sock_name(offset, len, name, lxcpath))
return -1; return -1;
...@@ -293,7 +295,7 @@ out: ...@@ -293,7 +295,7 @@ out:
int lxc_try_cmd(const char *name, const char *lxcpath) int lxc_try_cmd(const char *name, const char *lxcpath)
{ {
int stopped = 0, ret; int stopped, ret;
struct lxc_cmd_rr cmd = { struct lxc_cmd_rr cmd = {
.req = { .cmd = LXC_CMD_GET_INIT_PID }, .req = { .cmd = LXC_CMD_GET_INIT_PID },
}; };
...@@ -333,7 +335,7 @@ int lxc_try_cmd(const char *name, const char *lxcpath) ...@@ -333,7 +335,7 @@ int lxc_try_cmd(const char *name, const char *lxcpath)
*/ */
pid_t lxc_cmd_get_init_pid(const char *name, const char *lxcpath) pid_t lxc_cmd_get_init_pid(const char *name, const char *lxcpath)
{ {
int ret, stopped = 0; int ret, stopped;
struct lxc_cmd_rr cmd = { struct lxc_cmd_rr cmd = {
.req = { .cmd = LXC_CMD_GET_INIT_PID }, .req = { .cmd = LXC_CMD_GET_INIT_PID },
}; };
...@@ -363,7 +365,7 @@ static int lxc_cmd_get_init_pid_callback(int fd, struct lxc_cmd_req *req, ...@@ -363,7 +365,7 @@ static int lxc_cmd_get_init_pid_callback(int fd, struct lxc_cmd_req *req,
*/ */
int lxc_cmd_get_clone_flags(const char *name, const char *lxcpath) int lxc_cmd_get_clone_flags(const char *name, const char *lxcpath)
{ {
int ret, stopped = 0; int ret, stopped;
struct lxc_cmd_rr cmd = { struct lxc_cmd_rr cmd = {
.req = { .cmd = LXC_CMD_GET_CLONE_FLAGS }, .req = { .cmd = LXC_CMD_GET_CLONE_FLAGS },
}; };
...@@ -398,7 +400,7 @@ static int lxc_cmd_get_clone_flags_callback(int fd, struct lxc_cmd_req *req, ...@@ -398,7 +400,7 @@ static int lxc_cmd_get_clone_flags_callback(int fd, struct lxc_cmd_req *req,
char *lxc_cmd_get_cgroup_path(const char *name, const char *lxcpath, char *lxc_cmd_get_cgroup_path(const char *name, const char *lxcpath,
const char *subsystem) const char *subsystem)
{ {
int ret, stopped = 0; int ret, stopped;
struct lxc_cmd_rr cmd = { struct lxc_cmd_rr cmd = {
.req = { .req = {
.cmd = LXC_CMD_GET_CGROUP, .cmd = LXC_CMD_GET_CGROUP,
...@@ -458,7 +460,7 @@ static int lxc_cmd_get_cgroup_callback(int fd, struct lxc_cmd_req *req, ...@@ -458,7 +460,7 @@ static int lxc_cmd_get_cgroup_callback(int fd, struct lxc_cmd_req *req,
char *lxc_cmd_get_config_item(const char *name, const char *item, char *lxc_cmd_get_config_item(const char *name, const char *item,
const char *lxcpath) const char *lxcpath)
{ {
int ret, stopped = 0; int ret, stopped;
struct lxc_cmd_rr cmd = { struct lxc_cmd_rr cmd = {
.req = { .cmd = LXC_CMD_GET_CONFIG_ITEM, .req = { .cmd = LXC_CMD_GET_CONFIG_ITEM,
.data = item, .data = item,
...@@ -512,7 +514,7 @@ out: ...@@ -512,7 +514,7 @@ out:
*/ */
lxc_state_t lxc_cmd_get_state(const char *name, const char *lxcpath) lxc_state_t lxc_cmd_get_state(const char *name, const char *lxcpath)
{ {
int ret, stopped = 0; int ret, stopped;
struct lxc_cmd_rr cmd = { struct lxc_cmd_rr cmd = {
.req = { .cmd = LXC_CMD_GET_STATE } .req = { .cmd = LXC_CMD_GET_STATE }
}; };
...@@ -553,7 +555,7 @@ static int lxc_cmd_get_state_callback(int fd, struct lxc_cmd_req *req, ...@@ -553,7 +555,7 @@ static int lxc_cmd_get_state_callback(int fd, struct lxc_cmd_req *req,
*/ */
int lxc_cmd_stop(const char *name, const char *lxcpath) int lxc_cmd_stop(const char *name, const char *lxcpath)
{ {
int ret, stopped = 0; int ret, stopped;
struct lxc_cmd_rr cmd = { struct lxc_cmd_rr cmd = {
.req = { .cmd = LXC_CMD_STOP }, .req = { .cmd = LXC_CMD_STOP },
}; };
...@@ -618,7 +620,7 @@ static int lxc_cmd_stop_callback(int fd, struct lxc_cmd_req *req, ...@@ -618,7 +620,7 @@ static int lxc_cmd_stop_callback(int fd, struct lxc_cmd_req *req,
*/ */
int lxc_cmd_console_winch(const char *name, const char *lxcpath) int lxc_cmd_console_winch(const char *name, const char *lxcpath)
{ {
int ret, stopped = 0; int ret, stopped;
struct lxc_cmd_rr cmd = { struct lxc_cmd_rr cmd = {
.req = { .cmd = LXC_CMD_CONSOLE_WINCH }, .req = { .cmd = LXC_CMD_CONSOLE_WINCH },
}; };
...@@ -652,7 +654,7 @@ static int lxc_cmd_console_winch_callback(int fd, struct lxc_cmd_req *req, ...@@ -652,7 +654,7 @@ static int lxc_cmd_console_winch_callback(int fd, struct lxc_cmd_req *req,
*/ */
int lxc_cmd_console(const char *name, int *ttynum, int *fd, const char *lxcpath) int lxc_cmd_console(const char *name, int *ttynum, int *fd, const char *lxcpath)
{ {
int ret, stopped = 0; int ret, stopped;
struct lxc_cmd_console_rsp_data *rspdata; struct lxc_cmd_console_rsp_data *rspdata;
struct lxc_cmd_rr cmd = { struct lxc_cmd_rr cmd = {
.req = { .cmd = LXC_CMD_CONSOLE, .data = INT_TO_PTR(*ttynum) }, .req = { .cmd = LXC_CMD_CONSOLE, .data = INT_TO_PTR(*ttynum) },
......
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