[LTP] [PATCH 1/2] mq_timedreceive/5-3: Prevent override of errno

Joerg Vehlow lkml@jv-coder.de
Wed Feb 3 08:45:19 CET 2021


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



More information about the ltp mailing list