Skip to content

Commit

Permalink
commands: add additional check to lxc_cmd_sock_get_state()
Browse files Browse the repository at this point in the history
to please Coverity.

Fixes: Coverity 1461732.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Apr 15, 2020
1 parent c148bb7 commit 7792a5b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lxc/commands_utils.c
Expand Up @@ -62,11 +62,14 @@ int lxc_cmd_sock_get_state(const char *name, const char *lxcpath,

ret = lxc_cmd_add_state_client(name, lxcpath, states, &state_client_fd);
if (ret < 0)
return -1;
return ret_errno(EINVAL);

if (ret < MAX_STATE)
return ret;

if (state_client_fd < 0)
return ret_errno(EBADF);

return lxc_cmd_sock_rcv_state(state_client_fd, timeout);
}

Expand Down

0 comments on commit 7792a5b

Please sign in to comment.