linux-bluetooth.vger.kernel.org archive mirror
 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

* Re: [PATCH Bluez] tools/l2test: Fix potention double close
  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
  1 sibling, 0 replies; 3+ messages in thread
From: DoHyun Pyun @ 2015-07-23 14:02 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: steve.jun, DoHyun Pyun

Ping

2015-07-14 16:39 GMT+09:00, Dohyun Pyun <re20sfree@gmail.com>:
> 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	[flat|nested] 3+ messages in thread

* Re: [PATCH Bluez] tools/l2test: Fix potention double close
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Vinicius Costa Gomes @ 2015-07-23 21:23 UTC (permalink / raw)
  To: Dohyun Pyun, linux-bluetooth; +Cc: steve.jun, DoHyun Pyun

Hi,

Dohyun Pyun <re20sfree@gmail.com> writes:

> 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.

minor: typo on the subject: s/potention/potencial/.

The code looks good.


Cheers,
--
Vinicius

^ permalink raw reply	[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 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).