mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2025-01-22 04:13:30 +08:00
tools/l2cap-tester: Fix checking for write() return values
This commit is contained in:
parent
a663775dbf
commit
33eb51c937
@ -608,12 +608,17 @@ static gboolean l2cap_connect_cb(GIOChannel *io, GIOCondition cond,
|
||||
return FALSE;
|
||||
} else if (l2data->write_data) {
|
||||
struct bthost *bthost;
|
||||
ssize_t ret;
|
||||
|
||||
bthost = hciemu_client_get_host(data->hciemu);
|
||||
bthost_add_cid_hook(bthost, data->handle, data->dcid,
|
||||
bthost_received_data, NULL);
|
||||
|
||||
write(sk, l2data->write_data, l2data->data_len);
|
||||
ret = write(sk, l2data->write_data, l2data->data_len);
|
||||
if (ret != l2data->data_len) {
|
||||
tester_warn("Unable to write all data");
|
||||
tester_test_failed();
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@ -780,14 +785,20 @@ static gboolean l2cap_listen_cb(GIOChannel *io, GIOCondition cond,
|
||||
return FALSE;
|
||||
} else if (l2data->write_data) {
|
||||
struct bthost *bthost;
|
||||
ssize_t ret;
|
||||
|
||||
bthost = hciemu_client_get_host(data->hciemu);
|
||||
bthost_add_cid_hook(bthost, data->handle, data->scid,
|
||||
server_bthost_received_data, NULL);
|
||||
|
||||
write(new_sk, l2data->write_data, l2data->data_len);
|
||||
ret = write(new_sk, l2data->write_data, l2data->data_len);
|
||||
close(new_sk);
|
||||
|
||||
if (ret != l2data->data_len) {
|
||||
tester_warn("Unable to write all data");
|
||||
tester_test_failed();
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user