commands: add additional check to lxc_cmd_sock_get_state()

to please Coverity.

Fixes: Coverity 1461732.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
Christian Brauner 2020-04-15 13:59:19 +02:00
parent c148bb7d9f
commit 7792a5b60f
No known key found for this signature in database
GPG Key ID: 8EB056D53EECB12D

View File

@ -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);
}