Diff between a663775dbfbd9f3b8eff476d83f55c7f3012bf8d and 33eb51c9379db017624182085bdb4dc4e2b17cc6

Changed Files

File Additions Deletions Status
tools/l2cap-tester.c +13 -2 modified

Full Patch

diff --git a/tools/l2cap-tester.c b/tools/l2cap-tester.c
index 55e8ac9..7d0f3de 100644
--- a/tools/l2cap-tester.c
+++ b/tools/l2cap-tester.c
@@ -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;
 	}