client/player: add error code handling to transport_recv()

It is necessary to add return value check as in sock_send().

Found with the SVACE static analysis tool.
This commit is contained in:
Roman Smirnov 2024-07-10 14:31:46 +03:00 committed by Luiz Augusto von Dentz
parent ba70a116d9
commit 12525371ef

View File

@ -4514,7 +4514,13 @@ static bool transport_recv(struct io *io, void *user_data)
uint8_t buf[1024];
int ret, len;
ret = read(io_get_fd(io), buf, sizeof(buf));
ret = io_get_fd(io);
if (ret < 0) {
bt_shell_printf("io_get_fd() returned %d\n", ret);
return true;
}
ret = read(ret, buf, sizeof(buf));
if (ret < 0) {
bt_shell_printf("Failed to read: %s (%d)\n", strerror(errno),
-errno);