[LTP] [PATCH 2/2] mq_timedreceive_5-3: Fix test for timestamp after INT32_MAX
Joerg Vehlow
lkml@jv-coder.de
Wed Feb 3 08:45:20 CET 2021
From: Joerg Vehlow <joerg.vehlow@aox-tech.de>
The timeout for mq_timedreceive is absolute. Using INT32_MAX
breaks this test after 2038-01-19.
Signed-off-by: Joerg Vehlow <joerg.vehlow@aox-tech.de>
---
.../conformance/interfaces/mq_timedreceive/5-3.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/5-3.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/5-3.c
index 3f252a196..89d40721e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/5-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/5-3.c
@@ -28,6 +28,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <time.h>
#include "posixtest.h"
#define TEST "5-3"
@@ -70,7 +71,7 @@ int main(void)
sigemptyset(&act.sa_mask);
sigaction(SIGABRT, &act, 0);
- ts.tv_sec = INT32_MAX;
+ ts.tv_sec = time(NULL) + 5;
ts.tv_nsec = 0;
if (mq_timedreceive(mqdes, msgrv, BUFFER, NULL, &ts) == -1) {
--
2.25.1
More information about the ltp
mailing list