public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Joerg Vehlow <lkml@jv-coder.de>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/2] mq_timedreceive/5-3: Prevent override of errno
Date: Wed,  3 Feb 2021 08:45:19 +0100	[thread overview]
Message-ID: <20210203074520.18401-1-lkml@jv-coder.de> (raw)

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


             reply	other threads:[~2021-02-03  7:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-03  7:45 Joerg Vehlow [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210203074520.18401-1-lkml@jv-coder.de \
    --to=lkml@jv-coder.de \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox