From: Andrea Cervesato via ltp <ltp@lists.linux.it>
To: linuxtestproject.agent@gmail.com
Cc: ltp@lists.linux.it
Subject: Re: [LTP] close02: add test for double close EBADF
Date: Wed, 06 May 2026 12:10:17 +0000 [thread overview]
Message-ID: <69fb2faa.050a0220.230394.be73@mx.google.com> (raw)
In-Reply-To: <20260429151834.3982-1-linuxtestproject.agent@gmail.com>
Hi Jinseok,
The review agent is actually correct here. If we close the fd
with SAFE_CLOSE() it will end up having -1 value. You need to
use the raw close() plus checking its return value.
> Hi Jinseok,
>
> On 2026-04-29, Jinseok Kim wrote:
> > close02: add test for double close EBADF
>
> > +static void setup(void)
> > +{
> > + fd_closed = SAFE_OPEN("close02", O_CREAT | O_RDWR, 0600);
> > + SAFE_CLOSE(fd_closed);
> > +}
>
> SAFE_CLOSE(fd_closed) resets fd_closed to -1 (the macro does `fd = -1`
> after the close), so both test cases end up calling close(-1). The second
> case never exercises the double-close path. Use a local variable to
> preserve the fd value:
>
> int fd = SAFE_OPEN("close02", O_CREAT | O_RDWR, 0600);
> fd_closed = fd;
> SAFE_CLOSE(fd);
>
> ---
> Note:
>
> Our agent completed the review of the patch.
>
> The agent can sometimes produce false positives although often its
> findings are genuine. If you find issues with the review, please
> comment this email or ignore the suggestions.
>
> Regards,
> LTP AI Reviewer
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-05-06 12:10 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-06 13:30 [LTP] [PATCH 1/2] close: remove unused headers and fix minor style issues Jinseok Kim
2026-04-06 13:31 ` [LTP] [PATCH 2/2] close: add test for double close EBADF Jinseok Kim
2026-04-09 8:15 ` Petr Vorel
2026-04-11 11:04 ` [LTP] [PATCH v2] " Jinseok Kim
2026-04-13 4:33 ` Li Wang
2026-04-13 11:30 ` Petr Vorel
2026-04-13 16:52 ` [LTP] [PATCH v3] " Jinseok Kim
2026-04-13 18:04 ` [LTP] " linuxtestproject.agent
2026-04-13 20:45 ` [LTP] [PATCH v3] " Petr Vorel
2026-04-16 12:55 ` [LTP] [PATCH v4] close02: " Jinseok Kim
2026-04-16 13:44 ` [LTP] " linuxtestproject.agent
2026-04-17 0:01 ` [LTP] [PATCH v4] " Li Wang
2026-04-17 11:56 ` Petr Vorel
2026-04-21 14:42 ` [LTP] [PATCH v5] " Jinseok Kim
2026-04-21 15:16 ` [LTP] " linuxtestproject.agent
2026-04-22 11:41 ` [LTP] [PATCH v5] " Petr Vorel
2026-04-29 14:20 ` [LTP] [PATCH v6] " Jinseok Kim
2026-04-29 15:18 ` [LTP] " linuxtestproject.agent
2026-05-06 12:10 ` Andrea Cervesato via ltp [this message]
2026-05-12 15:25 ` [LTP] [PATCH v7] " Jinseok Kim
2026-05-12 17:15 ` [LTP] " linuxtestproject.agent
2026-05-13 7:07 ` Andrea Cervesato via ltp
2026-05-13 10:47 ` [LTP] [PATCH v7] " Petr Vorel
2026-04-09 8:08 ` [LTP] [PATCH 1/2] close: remove unused headers and fix minor style issues 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=69fb2faa.050a0220.230394.be73@mx.google.com \
--to=ltp@lists.linux.it \
--cc=andrea.cervesato@suse.com \
--cc=linuxtestproject.agent@gmail.com \
/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