All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Wang <liwang@redhat.com>
To: Cyril Hrubis <chrubis@suse.cz>
Cc: LTP List <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH] open04: add EMFILE check
Date: Fri, 16 Sep 2022 09:36:31 +0800	[thread overview]
Message-ID: <CAEemH2d_ckW9Zm77wRcoejiY0rCDB1Tpgs7c3LB=WNwYYLF7Hg@mail.gmail.com> (raw)
In-Reply-To: <YyM05nwf1+0eCd3w@yuki>


[-- Attachment #1.1: Type: text/plain, Size: 1327 bytes --]

On Thu, Sep 15, 2022 at 10:19 PM Cyril Hrubis <chrubis@suse.cz> wrote:

> Hi!
> > > diff --git a/testcases/kernel/syscalls/open/open04.c
> b/testcases/kernel/syscalls/open/open04.c
> > > index d452405d4..01a8b12d6 100644
> > > --- a/testcases/kernel/syscalls/open/open04.c
> > > +++ b/testcases/kernel/syscalls/open/open04.c
> > > @@ -33,7 +33,12 @@ static void setup(void)
> >
> > >     for (i = first + 1; i < fds_limit; i++) {
> > >             sprintf(fname, FNAME ".%d", i);
> > > -           fd = SAFE_OPEN(fname, O_RDWR | O_CREAT, 0777);
> > > +           fd = open(fname, O_RDWR | O_CREAT, 0777);
> > > +           if (fd == -1) {
> > > +                   if (errno != EMFILE)
> > > +                           tst_brk(TBROK, "Expected EMFILE but got
> %d", errno);
> > > +                   break;
> > > +           }
> > >             fds[i - first] = fd;
> > >     }
> > >  }
> >
> > LGTM.
> > Reviewed-by: Petr Vorel <pvorel@suse.cz>
>
> I faintly remmeber a similar patch where we decided not to work around
> for a test harness leaking filedescriptors into testcases.
>

This also should be a solution, I searched the mailing list and got a
patch[1].
Do you mean adding that close-on-exec flag when opening fd in harness?

[1] https://lists.linux.it/pipermail/ltp/2020-November/019650.html

-- 
Regards,
Li Wang

[-- Attachment #1.2: Type: text/html, Size: 2465 bytes --]

[-- Attachment #2: Type: text/plain, Size: 60 bytes --]


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

  reply	other threads:[~2022-09-16  1:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-15  3:10 [LTP] [PATCH] open04: add EMFILE check Li Wang
2022-09-15 12:52 ` Petr Vorel
2022-09-15 14:21   ` Cyril Hrubis
2022-09-16  1:36     ` Li Wang [this message]
2022-09-16  9:39       ` Cyril Hrubis
2022-09-19 12:12         ` Li Wang
2022-09-20  5:53           ` Li Wang
2022-09-20 14:21             ` Cyril Hrubis
2022-09-20 18:29             ` Petr Vorel

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='CAEemH2d_ckW9Zm77wRcoejiY0rCDB1Tpgs7c3LB=WNwYYLF7Hg@mail.gmail.com' \
    --to=liwang@redhat.com \
    --cc=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.