From: Dmitry V. Levin Date: Fri, 14 Apr 2017 15:55:21 +0000 (+0000) Subject: tests: make net-yy-netlink test executable reenterable X-Git-Tag: v4.17~94 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=106f57d11edcbe01a1002380c3ec7e61bf9ac9e0;p=strace tests: make net-yy-netlink test executable reenterable * tests/net-yy-netlink.c (main): Use getpid() instead of a fixed magic number. --- diff --git a/tests/net-yy-netlink.c b/tests/net-yy-netlink.c index 2a855d74..1d7001ed 100644 --- a/tests/net-yy-netlink.c +++ b/tests/net-yy-netlink.c @@ -1,7 +1,7 @@ /* * This file is part of net-yy-netlink strace test. * - * Copyright (c) 2013-2016 Dmitry V. Levin + * Copyright (c) 2013-2017 Dmitry V. Levin * Copyright (c) 2016 Fabien Siron * All rights reserved. * @@ -47,10 +47,9 @@ int main(void) { - unsigned magic = 1234; struct sockaddr_nl addr = { .nl_family = AF_NETLINK, - .nl_pid = 1234 + .nl_pid = getpid() }; struct sockaddr *const sa = tail_memdup(&addr, sizeof(addr)); TAIL_ALLOC_OBJECT_CONST_PTR(socklen_t, len); @@ -67,17 +66,17 @@ main(void) perror_msg_and_skip("bind"); printf("bind(%d, {sa_family=AF_NETLINK" ", nl_pid=%u, nl_groups=00000000}, %u) = 0\n", - fd, inode, magic, (unsigned) *len); + fd, inode, addr.nl_pid, (unsigned) *len); if (getsockname(fd, sa, len)) perror_msg_and_fail("getsockname"); printf("getsockname(%d, {sa_family=AF_NETLINK" ", nl_pid=%u, nl_groups=00000000}, [%u]) = 0\n", - fd, magic, magic, (unsigned) *len); + fd, addr.nl_pid, addr.nl_pid, (unsigned) *len); if (close(fd)) perror_msg_and_fail("close"); - printf("close(%d) = 0\n", fd, magic); + printf("close(%d) = 0\n", fd, addr.nl_pid); puts("+++ exited with 0 +++"); return 0;