All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH Bluez] tools/l2test: Fix potention double close
@ 2015-07-14  7:39 Dohyun Pyun
  2015-07-23 14:02 ` DoHyun Pyun
  2015-07-23 21:23 ` Vinicius Costa Gomes
  0 siblings, 2 replies; 3+ messages in thread
From: Dohyun Pyun @ 2015-07-14  7:39 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: steve.jun, DoHyun Pyun

From: DoHyun Pyun <dh79.pyun@samsung.com>

If the test gets an error after close the socket, the socket sk
will be closed again. This patch prevents the double close case.
---
 tools/l2test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/l2test.c b/tools/l2test.c
index abe09c1..1d458c4 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);
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-07-23 21:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-14  7:39 [PATCH Bluez] tools/l2test: Fix potention double close Dohyun Pyun
2015-07-23 14:02 ` DoHyun Pyun
2015-07-23 21:23 ` Vinicius Costa Gomes

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.