[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ltp-list
Subject:    [LTP] [PATCH] Don't read errno unless the syscall failed in
From:       "Jiri Palecek" <jpalecek () web ! de>
Date:       2010-01-22 11:28:08
Message-ID: 201001221128.o0MBS5SU020643 () mailer ! progressive-comp ! com
[Download RAW message or body]

Hello,

 I've seen failures reporting "return value=0, errno=EACCESS" in the
mq_notify01 test. This is because the syscall actually succeeded (as
expected by the test), but, as it is implemented by a library
function, some of the (more) syscalls it invoked failed. The POSIX
specification of errno says it should only be read when the call in
question failed - therefore, this patch hardcodes errno 0 when return
value is 0.

 Also, this patch removes a useless TEST macro usage in a place the
TEST_RETURN nor TEST_ERRNO variables are never checked.

Regards
    Jiri Palecek

Signed-off-by: Jiri Palecek <jpalecek@web.de>
---
 testcases/kernel/syscalls/mq_notify/mq_notify01.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/syscalls/mq_notify/mq_notify01.c \
b/testcases/kernel/syscalls/mq_notify/mq_notify01.c index 6004373..b796bc3 100644
--- a/testcases/kernel/syscalls/mq_notify/mq_notify01.c
+++ b/testcases/kernel/syscalls/mq_notify/mq_notify01.c
@@ -270,7 +270,7 @@ static int do_test(struct test_case *tc)
          * When test ended with SIGTERM etc, mq discriptor is left remains.
          * So we delete it first.
          */
-        TEST(mq_unlink(QUEUE_NAME));
+        mq_unlink(QUEUE_NAME);
 
         switch (tc->ttype) {
         case FD_NOT_EXIST:
@@ -336,7 +336,7 @@ static int do_test(struct test_case *tc)
          */
         errno = 0;
         sys_ret = mq_notify(fd, &ev);
-        sys_errno = errno;
+        sys_errno = sys_ret != 0 ? errno : 0;
         if (sys_ret < 0)
                 goto TEST_END;
 
-- 
1.6.4.3




------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic