From: Muhammad Usama Anjum <usama.anjum@collabora.com>
To: Amer Al Shanawany <amer.shanawany@gmail.com>,
Shuah Khan <shuah@kernel.org>,
Christian Brauner <brauner@kernel.org>,
Miklos Szeredi <mszeredi@redhat.com>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Muhammad Usama Anjum <usama.anjum@collabora.com>,
Javier Carrasco <javier.carrasco.cruz@gmail.com>
Subject: Re: [PATCH] selftests: filesystems: fix warn_unused_result build warnings
Date: Fri, 19 Apr 2024 21:41:59 +0500 [thread overview]
Message-ID: <58e0539d-423e-42e0-9ee4-8fc8e1eed94f@collabora.com> (raw)
In-Reply-To: <20240417184913.74734-1-amer.shanawany@gmail.com>
On 4/17/24 11:49 PM, Amer Al Shanawany wrote:
> Fix the following warnings by adding return check and error messages.
>
> statmount_test.c: In function ‘cleanup_namespace’:
> statmount_test.c:128:9: warning: ignoring return value of ‘fchdir’
> declared with attribute ‘warn_unused_result’ [-Wunused-result]
> 128 | fchdir(orig_root);
> | ^~~~~~~~~~~~~~~~~
> statmount_test.c:129:9: warning: ignoring return value of ‘chroot’
> declared with attribute ‘warn_unused_result’ [-Wunused-result]
> 129 | chroot(".");
> | ^~~~~~~~~~~
>
> Signed-off-by: Amer Al Shanawany <amer.shanawany@gmail.com>
Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> ---
> .../selftests/filesystems/statmount/statmount_test.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/filesystems/statmount/statmount_test.c b/tools/testing/selftests/filesystems/statmount/statmount_test.c
> index e6d7c4f1c85b..e8c019d72cbf 100644
> --- a/tools/testing/selftests/filesystems/statmount/statmount_test.c
> +++ b/tools/testing/selftests/filesystems/statmount/statmount_test.c
> @@ -125,8 +125,16 @@ static uint32_t old_root_id, old_parent_id;
>
> static void cleanup_namespace(void)
> {
> - fchdir(orig_root);
> - chroot(".");
> + int ret;
> +
> + ret = fchdir(orig_root);
> + if (ret == -1)
> + ksft_perror("fchdir to original root");
> +
> + ret = chroot(".");
> + if (ret == -1)
> + ksft_perror("chroot to original root");
> +
> umount2(root_mntpoint, MNT_DETACH);
> rmdir(root_mntpoint);
> }
--
BR,
Muhammad Usama Anjum
next prev parent reply other threads:[~2024-04-19 16:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-17 18:49 [PATCH] selftests: filesystems: fix warn_unused_result build warnings Amer Al Shanawany
2024-04-19 16:41 ` Muhammad Usama Anjum [this message]
2024-05-04 17:17 ` Amer Al Shanawany
2024-06-03 11:17 ` Amer Al Shanawany
2024-06-11 15:23 ` Shuah Khan
-- strict thread matches above, loose matches on Subject: below --
2024-08-10 13:53 Abhinav Jain
2024-08-16 13:11 ` Shuah Khan
2024-09-03 17:45 ` Shuah Khan
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=58e0539d-423e-42e0-9ee4-8fc8e1eed94f@collabora.com \
--to=usama.anjum@collabora.com \
--cc=amer.shanawany@gmail.com \
--cc=brauner@kernel.org \
--cc=javier.carrasco.cruz@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mszeredi@redhat.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox