Skip to contentSkip to conversation

recvmmsg01: Fix compilation

PATCH New Petr Vorel 1 participant 2 messages Sep 23, 2020

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

PATCH 1/1 recvmmsg01: Fix compilation

void* cannot be directly used, it must be pointing to the struct.

recvmmsg01.c:86:9: error: request for member ?type? in something not a structure or union
timeout.type = tv->ts_type;

Fixes 135af8ede ("syscalls/{send|recv}mmsg: add a test case for timeout

and errno test")

---
 testcases/kernel/syscalls/recvmmsg/recvmmsg01.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/recvmmsg/recvmmsg01.c +3 -2
index fe637430b..a16a78f9b 100644
@@ -65,7 +65,8 @@ static void do_test(unsigned int i)
 {
 	struct time64_variants *tv = &variants[tst_variant];
 	struct test_case *tc = &tcase[i];
-	void *rcv_msgvec, *timeout;
+	struct tst_ts t;
+	void *rcv_msgvec, *timeout = &t;
 
 	tst_res(TINFO, "case %s", tc->desc);
 
@@ -83,7 +84,7 @@ static void do_test(unsigned int i)
 	memset(rcv1->iov_base, 0, rcv1->iov_len);
 	memset(rcv2->iov_base, 0, rcv2->iov_len);
 
-	timeout.type = tv->ts_type;
+	((struct tst_ts*)timeout)->type = tv->ts_type;
 	tst_ts_set_sec(&ts, tc->tv_sec);
 	tst_ts_set_nsec(&ts, tc->tv_nsec);
 
Signature · 1 line
2.28.0
author
#1 lore raw

PATCH 1/1 recvmmsg01: Fix compilation

Hi,

this is wrong, Xao's solution is better:
http://lists.linux.it/pipermail/ltp/2020-September/019060.html

Kind regards,
Petr

Quoted 37 lines

void* cannot be directly used, it must be pointing to the struct.

recvmmsg01.c:86:9: error: request for member ?type? in something not a structure or union
timeout.type = tv->ts_type;

Fixes 135af8ede ("syscalls/{send|recv}mmsg: add a test case for timeout

and errno test")

---
 testcases/kernel/syscalls/recvmmsg/recvmmsg01.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/recvmmsg/recvmmsg01.c +3 -2
index fe637430b..a16a78f9b 100644
@@ -65,7 +65,8 @@ static void do_test(unsigned int i)
 {
 	struct time64_variants *tv = &variants[tst_variant];
 	struct test_case *tc = &tcase[i];
-	void *rcv_msgvec, *timeout;
+	struct tst_ts t;
+	void *rcv_msgvec, *timeout = &t;
 
 	tst_res(TINFO, "case %s", tc->desc);
 
@@ -83,7 +84,7 @@ static void do_test(unsigned int i)
 	memset(rcv1->iov_base, 0, rcv1->iov_len);
 	memset(rcv2->iov_base, 0, rcv2->iov_len);
 
-	timeout.type = tv->ts_type;
+	((struct tst_ts*)timeout)->type = tv->ts_type;
 	tst_ts_set_sec(&ts, tc->tv_sec);
 	tst_ts_set_nsec(&ts, tc->tv_nsec);