Coverity doesn't like closing invalid fds, let's satisfy it.
We initialize fd to -1 at function start, and don't set it
on some failure paths, so Coverity is right actually.
CID: 160042
Fixes: 11d0e070a6 ("net/tap: net_init_tap(): common fail label")
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
---
net/tap.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/tap.c b/net/tap.c
index 57ffb09885..64d6e8e82d 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -968,7 +968,9 @@ int net_init_tap(const Netdev *netdev, const char *name,
return 0;
fail:
- close(fd);
+ if (fd != -1) {
+ close(fd);
+ }
net_free_fds(fds, queues);
net_free_fds(vhost_fds, queues);
return -1;
--
2.43.0