Diff between f479c2404ecfb8723a1c4d55c7cbe8726ffcd6b7 and a2d47ef0522663fbd3887d198196647e28d2cf3c

Changed Files

File Additions Deletions Status
emulator/vhci.c +4 -2 modified

Full Patch

diff --git a/emulator/vhci.c b/emulator/vhci.c
index 7b36300..355ab63 100644
--- a/emulator/vhci.c
+++ b/emulator/vhci.c
@@ -122,14 +122,16 @@ struct vhci *vhci_open(uint8_t type)
 		break;
 	}
 
-	if (write(fd, &req, sizeof(req)) < 0) {
+	if (write(fd, &req, sizeof(req)) != sizeof(req)) {
 		close(fd);
 		return NULL;
 	}
 
 	memset(&rsp, 0, sizeof(rsp));
 
-	if (read(fd, &rsp, sizeof(rsp)) < 0) {
+	if (read(fd, &rsp, sizeof(rsp)) != sizeof(rsp) ||
+			rsp.pkt_type != HCI_VENDOR_PKT ||
+			rsp.opcode != req.opcode) {
 		close(fd);
 		return NULL;
 	}