From 33d6622172a85209f644840409d1b00ae94d609c Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Fri, 9 Oct 2020 11:28:57 -0700 Subject: test/syscall/iptables: don't use designated initializers test/syscalls/linux/iptables.cc:130:3: error: C99 designator 'name' outside aggregate initializer 130 | }; | PiperOrigin-RevId: 336331738 --- test/syscalls/linux/ip6tables.cc | 8 ++++---- test/syscalls/linux/iptables.cc | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'test/syscalls/linux') diff --git a/test/syscalls/linux/ip6tables.cc b/test/syscalls/linux/ip6tables.cc index de0a1c114..e0e146067 100644 --- a/test/syscalls/linux/ip6tables.cc +++ b/test/syscalls/linux/ip6tables.cc @@ -89,12 +89,12 @@ TEST(IP6TablesBasic, GetRevision) { ASSERT_THAT(sock = socket(AF_INET6, SOCK_RAW, IPPROTO_RAW), SyscallSucceeds()); - struct xt_get_revision rev = { - .name = "REDIRECT", - .revision = 0, - }; + struct xt_get_revision rev = {}; socklen_t rev_len = sizeof(rev); + snprintf(rev.name, sizeof(rev.name), "REDIRECT"); + rev.revision = 0; + // Revision 0 exists. EXPECT_THAT( getsockopt(sock, SOL_IPV6, IP6T_SO_GET_REVISION_TARGET, &rev, &rev_len), diff --git a/test/syscalls/linux/iptables.cc b/test/syscalls/linux/iptables.cc index 7ee10bbde..22550b800 100644 --- a/test/syscalls/linux/iptables.cc +++ b/test/syscalls/linux/iptables.cc @@ -124,12 +124,12 @@ TEST(IPTablesBasic, GetRevision) { ASSERT_THAT(sock = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP), SyscallSucceeds()); - struct xt_get_revision rev = { - .name = "REDIRECT", - .revision = 0, - }; + struct xt_get_revision rev = {}; socklen_t rev_len = sizeof(rev); + snprintf(rev.name, sizeof(rev.name), "REDIRECT"); + rev.revision = 0; + // Revision 0 exists. EXPECT_THAT( getsockopt(sock, SOL_IP, IPT_SO_GET_REVISION_TARGET, &rev, &rev_len), -- cgit v1.2.3