From acdba9c454506cdd29ac400df3f72bde4c74647d Mon Sep 17 00:00:00 2001
From: Masatake YAMATO <yamato@redhat.com>
Date: Wed, 3 Apr 2024 00:01:27 +0900
Subject: [PATCH] tests: (test_mkfds::netlink) pass a correct file descriptor
 to bind(2)

Close #2901

The original code passed a closed file descriptor to bind(2).

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
---
 tests/helpers/test_mkfds.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/helpers/test_mkfds.c b/tests/helpers/test_mkfds.c
index dd0a128a8..28ed3bffc 100644
--- a/tests/helpers/test_mkfds.c
+++ b/tests/helpers/test_mkfds.c
@@ -2293,6 +2293,7 @@ static void *make_netlink(const struct factory *factory, struct fdesc fdescs[],
 			err(EXIT_FAILURE, "failed to dup %d -> %d", sd, fdescs[0].fd);
 		}
 		close(sd);
+		sd = fdescs[0].fd;
 	}
 
 	struct sockaddr_nl nl;
-- 
2.33.0

