summaryrefslogtreecommitdiff
path: root/tools/l2test.c
diff options
context:
space:
mode:
authorDoHyun Pyun <dh79.pyun@samsung.com>2015-07-27 17:02:22 +0900
committerJohan Hedberg <johan.hedberg@intel.com>2015-07-27 11:22:40 +0300
commit779c9cc8969c8fbb69e0284a48541a2372eea415 (patch)
tree07911a6b2cdb08025d84914a0dbe260d953d22df /tools/l2test.c
parenta0fd2e4494f5c35152fe523d271ac7304ecb4591 (diff)
downloadbluez-779c9cc8969c8fbb69e0284a48541a2372eea415.tar.gz
tools/l2test: Fix potential double close
If the test gets an error after close the socket, the socket sk will be closed again. This patch prevents the double close case.
Diffstat (limited to 'tools/l2test.c')
-rw-r--r--tools/l2test.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/l2test.c b/tools/l2test.c
index abe09c125..1d458c4cc 100644
--- a/tools/l2test.c
+++ b/tools/l2test.c
@@ -644,7 +644,6 @@ static void do_listen(void (*handler)(int sk))
continue;
}
/* Child */
- close(sk);
/* Set receive buffer size */
if (rcvbuf && setsockopt(nsk, SOL_SOCKET, SO_RCVBUF, &rcvbuf,
@@ -769,6 +768,7 @@ static void do_listen(void (*handler)(int sk))
}
handler(nsk);
+ close(sk);
syslog(LOG_INFO, "Disconnect: %m");
exit(0);