]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: (test_mkfds::netlink) pass a correct file descriptor to bind(2)
authorMasatake YAMATO <yamato@redhat.com>
Tue, 2 Apr 2024 15:01:27 +0000 (00:01 +0900)
committerMasatake YAMATO <yamato@redhat.com>
Tue, 2 Apr 2024 15:01:27 +0000 (00:01 +0900)
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

index dd0a128a88cdc0b8f9a32a8a990ac1213fbdb41a..28ed3bffcb46b4995c7b41964e6a4c31a010be87 100644 (file)
@@ -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;