samples: net: sockets: echo_client : Fix tcp_stop() error
Check for an open socket, 0 is a valid file descriptor. Signed-off-by: Marcio Montenegro <msam@cesar.org.br>
This commit is contained in:
parent
ebce5601c0
commit
69613cad6a
1 changed files with 2 additions and 2 deletions
|
@ -242,13 +242,13 @@ int process_tcp(void)
|
||||||
void stop_tcp(void)
|
void stop_tcp(void)
|
||||||
{
|
{
|
||||||
if (IS_ENABLED(CONFIG_NET_IPV6)) {
|
if (IS_ENABLED(CONFIG_NET_IPV6)) {
|
||||||
if (conf.ipv6.tcp.sock > 0) {
|
if (conf.ipv6.tcp.sock >= 0) {
|
||||||
(void)close(conf.ipv6.tcp.sock);
|
(void)close(conf.ipv6.tcp.sock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_NET_IPV4)) {
|
if (IS_ENABLED(CONFIG_NET_IPV4)) {
|
||||||
if (conf.ipv4.tcp.sock > 0) {
|
if (conf.ipv4.tcp.sock >= 0) {
|
||||||
(void)close(conf.ipv4.tcp.sock);
|
(void)close(conf.ipv4.tcp.sock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue