diff mbox series

[mdnsd,03/10] interface: fix value stored to 'fd' is never read

Message ID 20201013133621.27088-4-ynezz@true.cz
State Accepted
Delegated to: Petr Štetiar
Headers show
Series fixes and improvements | expand

Commit Message

Petr Štetiar Oct. 13, 2020, 1:36 p.m. UTC
Fixes following issue reported by clang-12 static analyzer:

 mdnsd/interface.c:360:3: warning: Value stored to 'fd' is never read
                 fd = -1;
                 ^    ~~
 mdnsd/interface.c:394:3: warning: Value stored to 'fd' is never read
                 fd = -1;
                 ^    ~~

Original author most likely wanted to assing -1 to the original
interface filedescriptor.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
---
 interface.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/interface.c b/interface.c
index d3f2ad342201..690e8579a44c 100644
--- a/interface.c
+++ b/interface.c
@@ -357,7 +357,7 @@  interface_mcast_setup4(struct interface *iface)
 	if (setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq)) < 0) {
 		fprintf(stderr, "failed to join multicast group: %m\n");
 		close(fd);
-		fd = -1;
+		iface->fd.fd = -1;
 		return -1;
 	}
 
@@ -391,7 +391,7 @@  interface_socket_setup6(struct interface *iface)
 	if (setsockopt(fd, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, &mreq, sizeof(mreq)) < 0) {
 		fprintf(stderr, "failed to join multicast group: %m\n");
 		close(fd);
-		fd = -1;
+		iface->fd.fd = -1;
 		return -1;
 	}