public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] mq_timedreceive/5-3: Prevent override of errno
@ 2021-02-03  7:45 Joerg Vehlow
  2021-02-03  7:45 ` [LTP] [PATCH 2/2] mq_timedreceive_5-3: Fix test for timestamp after INT32_MAX Joerg Vehlow
  0 siblings, 1 reply; 4+ messages in thread
From: Joerg Vehlow @ 2021-02-03  7:45 UTC (permalink / raw)
  To: ltp

From: Joerg Vehlow <joerg.vehlow@aox-tech.de>

wait can override the errno set by mq_timedreceive and
the check for EINTR might fail or not fail if it should.

Signed-off-by: Joerg Vehlow <joerg.vehlow@aox-tech.de>
---
 .../conformance/interfaces/mq_timedreceive/5-3.c           | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

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 e773aeb14..3f252a196 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
@@ -74,16 +74,17 @@ int main(void)
 		ts.tv_nsec = 0;
 
 		if (mq_timedreceive(mqdes, msgrv, BUFFER, NULL, &ts) == -1) {
-			wait(NULL);
 			if (EINTR != errno) {
 				printf("errno != EINTR\n");
 				failure = 1;
 			}
 		} else {
-			wait(NULL);
-			printf("mq_timedreceive() succeed unexpectly\n");
+			printf("mq_timedreceive() succeeded unexpectedly\n");
 			failure = 1;
 		}
+		
+		wait(NULL);
+
 		if (mq_close(mqdes) != 0) {
 			perror("mq_close() did not return success");
 			unresolved = 1;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [LTP] [PATCH 2/2] mq_timedreceive_5-3: Fix test for timestamp after INT32_MAX
  2021-02-03  7:45 [LTP] [PATCH 1/2] mq_timedreceive/5-3: Prevent override of errno Joerg Vehlow
@ 2021-02-03  7:45 ` Joerg Vehlow
  2021-02-03  7:48   ` Joerg Vehlow
  0 siblings, 1 reply; 4+ messages in thread
From: Joerg Vehlow @ 2021-02-03  7:45 UTC (permalink / raw)
  To: ltp

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [LTP] [PATCH 2/2] mq_timedreceive_5-3: Fix test for timestamp after INT32_MAX
  2021-02-03  7:45 ` [LTP] [PATCH 2/2] mq_timedreceive_5-3: Fix test for timestamp after INT32_MAX Joerg Vehlow
@ 2021-02-03  7:48   ` Joerg Vehlow
  2021-02-12 15:15     ` Cyril Hrubis
  0 siblings, 1 reply; 4+ messages in thread
From: Joerg Vehlow @ 2021-02-03  7:48 UTC (permalink / raw)
  To: ltp

Just FYI:

On 2/3/2021 8:45 AM, Joerg Vehlow wrote:
> 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.
Funny thing is, that the other bug fixed in the first patch hid this bug.
mq_timedreceive returned with ETIMEDOUT immediately, but wait blocked,
until it was interrupted by the signal -> erno was EINTR and the test 
passed.

J?rg

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [LTP] [PATCH 2/2] mq_timedreceive_5-3: Fix test for timestamp after INT32_MAX
  2021-02-03  7:48   ` Joerg Vehlow
@ 2021-02-12 15:15     ` Cyril Hrubis
  0 siblings, 0 replies; 4+ messages in thread
From: Cyril Hrubis @ 2021-02-12 15:15 UTC (permalink / raw)
  To: ltp

Hi!
Good catch, I've removed trailing whitespaces from the first patch and
pushed both, thanks.


-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-12 15:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-03  7:45 [LTP] [PATCH 1/2] mq_timedreceive/5-3: Prevent override of errno Joerg Vehlow
2021-02-03  7:45 ` [LTP] [PATCH 2/2] mq_timedreceive_5-3: Fix test for timestamp after INT32_MAX Joerg Vehlow
2021-02-03  7:48   ` Joerg Vehlow
2021-02-12 15:15     ` Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox