mdns: do not close an fd that is not open
authorFerry Huberts <ferry.huberts@pelagic.nl>
Tue, 23 Oct 2012 09:45:03 +0000 (11:45 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Tue, 23 Oct 2012 11:45:14 +0000 (13:45 +0200)
Coverity:
CID 739656 (#5 of 14): Argument cannot be negative (NEGATIVE_RETURNS)
At (8): "encapsulatingSkfd" is passed to a parameter that cannot be
        negative.
CID 739656 (#7-8 of 14): Argument cannot be negative (NEGATIVE_RETURNS)
At (10): "encapsulatingSkfd" is passed to a parameter that cannot be
         negative.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/mdns/src/NetworkInterfaces.c

index a5d7f1e..e09300b 100644 (file)
@@ -464,7 +464,6 @@ CreateInterface(const char *ifName, struct interface *olsrIntf)
     electionSkfd = CreateRouterElectionSocket(ifName);
     helloSkfd = CreateHelloSocket(ifName);
     if (capturingSkfd < 0 || electionSkfd < 0 || helloSkfd < 0) {
-      close(encapsulatingSkfd);
       close(capturingSkfd);
       close(electionSkfd);
       close(helloSkfd);
@@ -486,7 +485,6 @@ CreateInterface(const char *ifName, struct interface *olsrIntf)
   if (ioctl(ioctlSkfd, SIOCGIFHWADDR, &ifr) < 0) {
     BmfPError("ioctl(SIOCGIFHWADDR) error for interface \"%s\"", ifName);
     close(capturingSkfd);
-    close(encapsulatingSkfd);
     close(electionSkfd);
     close(helloSkfd);
     free(newIf);