summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2004-06-28 10:57:18 +0000
committerMarcel Holtmann <marcel@holtmann.org>2004-06-28 10:57:18 +0000
commit4b2d32e1fe19c4b84d925bc1d6bb2bd0e39cb156 (patch)
treeb756d703ce0b9bdc3faa5b34f67541f04ae259de
parent587fe743849609dd150666d84f8fa53cd403a70e (diff)
Set olen before calling getsockopt()
-rw-r--r--pand/main.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/pand/main.c b/pand/main.c
index d4a29867..9dfa18a1 100644
--- a/pand/main.c
+++ b/pand/main.c
@@ -136,6 +136,7 @@ static int do_listen(void)
}
/* Setup L2CAP options according to BNEP spec */
+ olen = sizeof(l2o);
if (getsockopt(sk, SOL_L2CAP, L2CAP_OPTIONS, &l2o, &olen) < 0) {
syslog(LOG_ERR, "Failed to get L2CAP options. %s(%d)",
strerror(errno), errno);
@@ -257,6 +258,7 @@ static int create_connection(char *dst, bdaddr_t *bdaddr)
}
/* Setup L2CAP options according to BNEP spec */
+ olen = sizeof(l2o);
getsockopt(sk, SOL_L2CAP, L2CAP_OPTIONS, &l2o, &olen);
l2o.imtu = l2o.omtu = BNEP_MTU;
setsockopt(sk, SOL_L2CAP, L2CAP_OPTIONS, &l2o, sizeof(l2o));