git: 41a0a99f855f - main - vfs: slightly reorganize error handling in chroot
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 17 Sep 2022 09:11:39 UTC
The branch main has been updated by mjg:
URL: https://cgit.FreeBSD.org/src/commit/?id=41a0a99f855fd28ec2a73685bea0fdcfaddaa4d6
commit 41a0a99f855fd28ec2a73685bea0fdcfaddaa4d6
Author: Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2022-09-17 01:19:42 +0000
Commit: Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2022-09-17 09:08:34 +0000
vfs: slightly reorganize error handling in chroot
This avoids duplicated NDFREE_NOTHING which will be of importance
later.
---
sys/kern/vfs_syscalls.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 85f85c5f1a99..006ee24cac25 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1000,7 +1000,8 @@ sys_chroot(struct thread *td, struct chroot_args *uap)
UIO_USERSPACE, uap->path);
error = namei(&nd);
if (error != 0)
- goto error;
+ return (error);
+ NDFREE_NOTHING(&nd);
error = change_dir(nd.ni_vp, td);
if (error != 0)
goto e_vunlock;
@@ -1012,12 +1013,9 @@ sys_chroot(struct thread *td, struct chroot_args *uap)
VOP_UNLOCK(nd.ni_vp);
error = pwd_chroot(td, nd.ni_vp);
vrele(nd.ni_vp);
- NDFREE_NOTHING(&nd);
return (error);
e_vunlock:
vput(nd.ni_vp);
-error:
- NDFREE_NOTHING(&nd);
return (error);
}