Skip to content

Commit

Permalink
p2pd: do not close an fd that is not open
Browse files Browse the repository at this point in the history
Coverity:
CID 739656 (#6 of 8): Argument cannot be negative (NEGATIVE_RETURNS)
At (7): "capturingSkfd" is passed to a parameter that cannot be negative.

Signed-off-by: Ferry Huberts <[email protected]>
  • Loading branch information
fhuberts committed Oct 23, 2012
1 parent 4a65c93 commit 0abbc30
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/p2pd/src/NetworkInterfaces.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@ CreateInterface(const char *ifName, struct interface *olsrIntf)
ifr.ifr_name[IFNAMSIZ - 1] = '\0'; /* Ensures null termination */
if (ioctl(ioctlSkfd, SIOCGIFHWADDR, &ifr) < 0) {
P2pdPError("ioctl(SIOCGIFHWADDR) error for interface \"%s\"", ifName);
close(capturingSkfd);
if (capturingSkfd >= 0) {
close(capturingSkfd);
}
free(newIf);
return 0;
}
Expand Down

0 comments on commit 0abbc30

Please sign in to comment.