ltp.lists.linux.it archive mirror
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2 2/5] syscalls: Add epoll_wait13
Date: Fri, 31 Jul 2026 14:17:59 +0200	[thread overview]
Message-ID: <amySdwkUDnYyQSNK@yuki.lan> (raw)
In-Reply-To: <6a6b3120.16149c93.268d1c.58c5@mx.google.com>

Hi!
> >		if (fds[i][0] > 0) {
> >			  SAFE_CLOSE(fds[i][0]);
> >			  SAFE_CLOSE(fds[i][1]);
> >		}
> 
> It's worth to change the statement to check for fd != -1.
> Otherwise:

Fixed with:

diff --git a/testcases/kernel/syscalls/epoll_wait/epoll_wait13.c b/testcases/kernel/syscalls/epoll_wait/epoll_wait13.c
index 8a8446baa..53a75ef1a 100644
--- a/testcases/kernel/syscalls/epoll_wait/epoll_wait13.c
+++ b/testcases/kernel/syscalls/epoll_wait/epoll_wait13.c
@@ -56,15 +56,28 @@ static void close_fds(int fds[][2], int n)
        int i;
 
        for (i = 0; i < n; i++) {
-               if (fds[i][0] > 0) {
+               if (fds[i][0] != -1) {
                        SAFE_CLOSE(fds[i][0]);
                        SAFE_CLOSE(fds[i][1]);
                }
        }
 }
 
+static void init_fds(int fds[][2], int n)
+{
+       int i;
+
+       for (i = 0; i < n; i++) {
+               fds[i][0] = -1;
+               fds[i][1] = -1;
+       }
+}
+
 static void setup(void)
 {
+       init_fds(ready_fds, NREADY);
+       init_fds(quiet_fds, NQUIET);
+
        epfd = SAFE_EPOLL_CREATE1(0);
 
        register_fds(ready_fds, NREADY, 0);

And pushed, thanks.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2026-07-31 12:18 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-15 12:36 [LTP] [PATCH v2 0/5] Even more epoll tests Cyril Hrubis
2026-07-15 12:36 ` [LTP] [PATCH v2 1/5] syscalls: Add epoll_ctl07 Cyril Hrubis
2026-07-15 12:59   ` [LTP] " linuxtestproject.agent
2026-07-30  8:49   ` [LTP] [PATCH v2 1/5] " Andrea Cervesato via ltp
2026-07-15 12:36 ` [LTP] [PATCH v2 2/5] syscalls: Add epoll_wait13 Cyril Hrubis
2026-07-30 11:10   ` Andrea Cervesato via ltp
2026-07-31 12:17     ` Cyril Hrubis [this message]
2026-07-15 12:36 ` [LTP] [PATCH v2 3/5] syscalls: Add epoll_wait14 Cyril Hrubis
2026-07-30 11:12   ` Andrea Cervesato via ltp
2026-07-31 12:19     ` Cyril Hrubis
2026-07-15 12:36 ` [LTP] [PATCH v2 4/5] syscalls: Add epoll_wait15 Cyril Hrubis
2026-07-30 11:15   ` Andrea Cervesato via ltp
2026-07-31 12:27     ` Cyril Hrubis
2026-07-15 12:36 ` [LTP] [PATCH v2 5/5] syscalls: Add epoll_wait16 EPOLLEXCLUSIVE test Cyril Hrubis
2026-07-30 11:17   ` Andrea Cervesato via ltp
2026-07-31 12:43     ` 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=amySdwkUDnYyQSNK@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=andrea.cervesato@suse.com \
    --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;
as well as URLs for NNTP newsgroup(s).