public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v3 3/3] syscalls/shmget*: Convert into new api
Date: Mon, 28 Jun 2021 17:05:05 +0200	[thread overview]
Message-ID: <YNnlIVB9M4/11JmT@yuki> (raw)
In-Reply-To: <1624512827-3256-3-git-send-email-xuyang2018.jy@fujitsu.com>

Hi!
Pushed with a minor changes, thanks.

diff --git a/testcases/kernel/syscalls/ipc/shmget/shmget03.c b/testcases/kernel/syscalls/ipc/shmget/shmget03.c
index 81841788c..efbc465e1 100644
--- a/testcases/kernel/syscalls/ipc/shmget/shmget03.c
+++ b/testcases/kernel/syscalls/ipc/shmget/shmget03.c
@@ -41,7 +41,6 @@ static void setup(void)
 
        queues = SAFE_MALLOC(maxshms * sizeof(int));
        for (num = 0; num < maxshms; num++) {
-               queues[num] = -1;
                res = shmget(shmkey + num, SHM_SIZE, IPC_CREAT | IPC_EXCL | SHM_RW);
                if (res == -1)
                        tst_brk(TBROK | TERRNO, "shmget failed unexpectedly");
@@ -59,10 +58,8 @@ static void cleanup(void)
        if (!queues)
                return;
 
-       for (num = 0; num < queue_cnt; num++) {
-               if (queues[num] != -1)
-                       SAFE_SHMCTL(queues[num], IPC_RMID, NULL);
-       }
+       for (num = 0; num < queue_cnt; num++)
+               SAFE_SHMCTL(queues[num], IPC_RMID, NULL);
 
        free(queues);
 }

As there is no need to check for -1 and pre-initialize the array
anymore.

-- 
Cyril Hrubis
chrubis@suse.cz

  reply	other threads:[~2021-06-28 15:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <YNM4rlDJLzb4xk6v@yuki>
2021-06-24  5:33 ` [LTP] [PATCH v3 1/3] lib: Add SAFE_SETGROUPS() and SAFE_GETGROUPS() function to LTP library Yang Xu
2021-06-24  5:33   ` [LTP] [PATCH v3 2/3] include/tst_test_macro.h: Add TST_EXP_FAIL2 macros Yang Xu
2021-06-28 15:02     ` Cyril Hrubis
2021-06-24  5:33   ` [LTP] [PATCH v3 3/3] syscalls/shmget*: Convert into new api Yang Xu
2021-06-28 15:05     ` Cyril Hrubis [this message]
2021-07-05 10:03       ` Krzysztof Kozlowski
2021-07-06 13:22         ` Thadeu Lima de Souza Cascardo
2021-07-22 10:51     ` Cyril Hrubis
2021-07-23  4:36       ` xuyang2018.jy
2021-06-28 15:01   ` [LTP] [PATCH v3 1/3] lib: Add SAFE_SETGROUPS() and SAFE_GETGROUPS() function to LTP library 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=YNnlIVB9M4/11JmT@yuki \
    --to=chrubis@suse.cz \
    --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