From: Shuah Khan <skhan@linuxfoundation.org>
To: Andrea Righi <andrea.righi@canonical.com>,
Shuah Khan <shuah@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>
Cc: linux-kselftest@vger.kernel.org, bpf@vger.kernel.org,
linux-kernel@vger.kernel.org,
Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH] selftests/bpf: fix fclose/pclose mismatch
Date: Tue, 26 Oct 2021 11:47:26 -0600 [thread overview]
Message-ID: <ce41c5da-2952-e800-54be-51cbcc7a0ada@linuxfoundation.org> (raw)
In-Reply-To: <20211026143409.42666-1-andrea.righi@canonical.com>
On 10/26/21 8:34 AM, Andrea Righi wrote:
> Make sure to use pclose() to properly close the pipe opened by popen().
>
> Fixes: 81f77fd0deeb ("bpf: add selftest for stackmap with BPF_F_STACK_BUILD_ID")
> Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
> ---
> tools/testing/selftests/bpf/test_progs.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
> index cc1cd240445d..e3fea6f281e4 100644
> --- a/tools/testing/selftests/bpf/test_progs.c
> +++ b/tools/testing/selftests/bpf/test_progs.c
> @@ -370,7 +370,7 @@ int extract_build_id(char *build_id, size_t size)
>
> if (getline(&line, &len, fp) == -1)
> goto err;
> - fclose(fp);
> + pclose(fp);
>
> if (len > size)
> len = size;
> @@ -379,7 +379,7 @@ int extract_build_id(char *build_id, size_t size)
> free(line);
> return 0;
> err:
> - fclose(fp);
> + pclose(fp);
> return -1;
> }
>
>
Thank you for the patch. The return logic could be simpler
doing out handling common for error and success path with
just one call to close. Not related to this change though.
Adding bpf maintainers to the thread
Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
thanks,
-- Shuah
next prev parent reply other threads:[~2021-10-26 17:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-26 14:34 [PATCH] selftests/bpf: fix fclose/pclose mismatch Andrea Righi
2021-10-26 17:47 ` Shuah Khan [this message]
2021-10-26 17:54 ` Alexei Starovoitov
2021-10-29 4:56 ` Martin KaFai Lau
2021-10-29 15:50 ` patchwork-bot+netdevbpf
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=ce41c5da-2952-e800-54be-51cbcc7a0ada@linuxfoundation.org \
--to=skhan@linuxfoundation.org \
--cc=andrea.righi@canonical.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=shuah@kernel.org \
/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.