On Mon, Jul 17, 2017 at 11:07:46PM +0800, JingPiao Chen wrote:
> * tests/nlattr_nlmsgerr.c: New file.
> * tests/gen_tests.in (nlattr_nlmsgerr): New entry.
> * tests/pure_executables.list: Add nlattr_nlmsgerr.
> * tests/.gitignore: Likewise.
[...]
> +int
> +main(void)
> +{
> +     skip_if_unavailable("/proc/self/fd/");
> +
> +     const int fd = create_nl_socket(NETLINK_SOCK_DIAG);
> +     const unsigned int hdrlen = sizeof(struct nlmsgerr);
> +     void *const nlh0 = tail_alloc(NLMSG_SPACE(hdrlen));
> +
> +     static char pattern[4096];
> +     fill_memory_ex(pattern, sizeof(pattern), 'a', 'z' - 'a' + 1);
> +
> +     static const uint8_t cookie[] = { 0xab, 0xfe };
> +     TEST_NLATTR(fd, nlh0, hdrlen,
> +                 init_nlmsgerr, print_nlmsgerr,
> +                 NLMSGERR_ATTR_COOKIE,
> +                 sizeof(cookie), cookie, sizeof(cookie),
> +                 printf("[%u, %u]", cookie[0], cookie[1]);
> +                 printf("}"));
> +
> +     printf("+++ exited with 0 +++\n");
> +     return 0;
> +}

Note that pattern is initialized but never used here.
Shouldn't TEST_NLATTR_ARRAY be used here instead of TEST_NLATTR?


-- 
ldv

Attachment: signature.asc
Description: PGP signature

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to