summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2004-12-25 17:43:16 +0000
committerMarcel Holtmann <marcel@holtmann.org>2004-12-25 17:43:16 +0000
commitbbda499067067aefc8e642a2784d247ac0331eae (patch)
treea702f2c2ba1716b29c5f3b4d019c4590330ff461 /test
parentac243219976dab3363bcd3215f963eb0026af788 (diff)
Add memset() to different places to initialize the structures
Diffstat (limited to 'test')
-rw-r--r--test/hstest.c6
-rw-r--r--test/l2test.c2
2 files changed, 8 insertions, 0 deletions
diff --git a/test/hstest.c b/test/hstest.c
index 98428b68e..f269621cf 100644
--- a/test/hstest.c
+++ b/test/hstest.c
@@ -98,6 +98,7 @@ static int sco_connect(bdaddr_t *src, bdaddr_t *dst, uint16_t *handle, uint16_t
memset(&addr, 0, sizeof(addr));
addr.sco_family = AF_BLUETOOTH;
bacpy(&addr.sco_bdaddr, src);
+
if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
close(s);
return -1;
@@ -106,18 +107,23 @@ static int sco_connect(bdaddr_t *src, bdaddr_t *dst, uint16_t *handle, uint16_t
memset(&addr, 0, sizeof(addr));
addr.sco_family = AF_BLUETOOTH;
bacpy(&addr.sco_bdaddr, dst);
+
if (connect(s, (struct sockaddr *)&addr, sizeof(addr)) < 0 ){
close(s);
return -1;
}
+ memset(&conn, 0, sizeof(conn));
size = sizeof(conn);
+
if (getsockopt(s, SOL_SCO, SCO_CONNINFO, &conn, &size) < 0) {
close(s);
return -1;
}
+ memset(&opts, 0, sizeof(opts));
size = sizeof(opts);
+
if (getsockopt(s, SOL_SCO, SCO_OPTIONS, &opts, &size) < 0) {
close(s);
return -1;
diff --git a/test/l2test.c b/test/l2test.c
index eedf4b705..627d37f1a 100644
--- a/test/l2test.c
+++ b/test/l2test.c
@@ -192,6 +192,7 @@ int do_connect(char *svr)
}
/* Get default options */
+ memset(&opts, 0, sizeof(opts));
opt = sizeof(opts);
if (getsockopt(s, SOL_L2CAP, L2CAP_OPTIONS, &opts, &opt) < 0) {
syslog(LOG_ERR, "Can't get default L2CAP options. %s(%d)", strerror(errno), errno);
@@ -236,6 +237,7 @@ int do_connect(char *svr)
return -1;
}
+ memset(&opts, 0, sizeof(opts));
opt = sizeof(opts);
if (getsockopt(s, SOL_L2CAP, L2CAP_OPTIONS, &opts, &opt) < 0) {
syslog(LOG_ERR, "Can't get L2CAP options. %s(%d)", strerror(errno), errno);