diff mbox series

[v2,3/6] idmapped-mounts: Reset errno to zero after detect fs_allow_idmap

Message ID 1649333375-2599-3-git-send-email-xuyang2018.jy@fujitsu.com (mailing list archive)
State New, archived
Headers show
Series [v2,1/6] idmapped-mount: split setgid test from test-core | expand

Commit Message

Yang Xu (Fujitsu) April 7, 2022, 12:09 p.m. UTC
If we run case on old kernel that doesn't support mount_setattr and
then fail on our own function before call is_setgid/is_setuid function
to reset errno, run_test will print "Function not implement" error.

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 src/idmapped-mounts/idmapped-mounts.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Christian Brauner April 7, 2022, 12:59 p.m. UTC | #1
On Thu, Apr 07, 2022 at 08:09:32PM +0800, Yang Xu wrote:
> If we run case on old kernel that doesn't support mount_setattr and
> then fail on our own function before call is_setgid/is_setuid function
> to reset errno, run_test will print "Function not implement" error.
> 
> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
> ---
>  src/idmapped-mounts/idmapped-mounts.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/idmapped-mounts/idmapped-mounts.c b/src/idmapped-mounts/idmapped-mounts.c
> index e8a856de..d2638c64 100644
> --- a/src/idmapped-mounts/idmapped-mounts.c
> +++ b/src/idmapped-mounts/idmapped-mounts.c
> @@ -14254,6 +14254,8 @@ int main(int argc, char *argv[])
>  		die("failed to open %s", t_mountpoint_scratch);
>  
>  	t_fs_allow_idmap = fs_allow_idmap();
> +	/*Don't copy ENOSYS errno to child proecss on older kernel*/

nit: s/proecess/process/
diff mbox series

Patch

diff --git a/src/idmapped-mounts/idmapped-mounts.c b/src/idmapped-mounts/idmapped-mounts.c
index e8a856de..d2638c64 100644
--- a/src/idmapped-mounts/idmapped-mounts.c
+++ b/src/idmapped-mounts/idmapped-mounts.c
@@ -14254,6 +14254,8 @@  int main(int argc, char *argv[])
 		die("failed to open %s", t_mountpoint_scratch);
 
 	t_fs_allow_idmap = fs_allow_idmap();
+	/*Don't copy ENOSYS errno to child proecss on older kernel*/
+	errno = 0;
 	if (supported) {
 		/*
 		 * Caller just wants to know whether the filesystem we're on