commands: simplify lxc_cmd()

parent 3cc0d428
...@@ -309,21 +309,22 @@ static int lxc_cmd(const char *name, struct lxc_cmd_rr *cmd, int *stopped, ...@@ -309,21 +309,22 @@ static int lxc_cmd(const char *name, struct lxc_cmd_rr *cmd, int *stopped,
if (client_fd < 0) { if (client_fd < 0) {
TRACE("%s - Command \"%s\" failed to connect command socket", TRACE("%s - Command \"%s\" failed to connect command socket",
strerror(errno), lxc_cmd_str(cmd->req.cmd)); strerror(errno), lxc_cmd_str(cmd->req.cmd));
if (client_fd == -ECONNREFUSED) {
if (client_fd == -ECONNREFUSED)
*stopped = 1; *stopped = 1;
return -1;
}
if (client_fd == -EPIPE) if (client_fd == -EPIPE) {
goto epipe; *stopped = 1;
client_fd = 0;
}
goto out; return client_fd;
} }
ret = lxc_cmd_rsp_recv(client_fd, cmd); ret = lxc_cmd_rsp_recv(client_fd, cmd);
if (ret == -ECONNRESET) if (ret == -ECONNRESET)
*stopped = 1; *stopped = 1;
out:
if (!stay_connected || ret <= 0) if (!stay_connected || ret <= 0)
if (client_fd >= 0) if (client_fd >= 0)
close(client_fd); close(client_fd);
...@@ -332,10 +333,6 @@ out: ...@@ -332,10 +333,6 @@ out:
cmd->rsp.ret = client_fd; cmd->rsp.ret = client_fd;
return ret; return ret;
epipe:
*stopped = 1;
return 0;
} }
int lxc_try_cmd(const char *name, const char *lxcpath) int lxc_try_cmd(const char *name, const char *lxcpath)
......
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