git: 3e0b4868869d - main - vfs: flip a condition around in kern_statat

From: Mateusz Guzik <mjg_at_FreeBSD.org>
Date: Wed, 07 Sep 2022 20:11:28 UTC
The branch main has been updated by mjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=3e0b4868869d4373aeebae01ad777def318ce14f

commit 3e0b4868869d4373aeebae01ad777def318ce14f
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2022-09-07 20:05:32 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2022-09-07 20:06:24 +0000

    vfs: flip a condition around in kern_statat
    
    error tends to be 0.
---
 sys/kern/vfs_syscalls.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index c40d1092574e..85f85c5f1a99 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -2450,9 +2450,10 @@ kern_statat(struct thread *td, int flag, int fd, const char *path,
 		return (error);
 	}
 	error = VOP_STAT(nd.ni_vp, sbp, td->td_ucred, NOCRED);
-	if (error == 0) {
-		if (__predict_false(hook != NULL))
+	if (__predict_false(hook != NULL)) {
+		if (error == 0) {
 			hook(nd.ni_vp, sbp);
+		}
 	}
 	NDFREE_NOTHING(&nd);
 	vput(nd.ni_vp);