linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 BLUEZ] tools/l2test: Fix potential double close
       [not found] <1437546336-10105-1-git-send-email-dh79.pyun@samsung.com>
@ 2015-07-27  8:02 ` Dohyun Pyun
  2015-07-27  8:23   ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Dohyun Pyun @ 2015-07-27  8:02 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: 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] 2+ messages in thread

* Re: [PATCH v2 BLUEZ] tools/l2test: Fix potential double close
  2015-07-27  8:02 ` [PATCH v2 BLUEZ] tools/l2test: Fix potential double close Dohyun Pyun
@ 2015-07-27  8:23   ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2015-07-27  8:23 UTC (permalink / raw)
  To: Dohyun Pyun; +Cc: linux-bluetooth

Hi Pyun,

On Mon, Jul 27, 2015, Dohyun Pyun wrote:
> 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(-)

Applied. Thanks.

Johan

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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1437546336-10105-1-git-send-email-dh79.pyun@samsung.com>
2015-07-27  8:02 ` [PATCH v2 BLUEZ] tools/l2test: Fix potential double close Dohyun Pyun
2015-07-27  8:23   ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).