summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-06-09 04:38:07 -0400
committerIan Moffett <ian@osmora.org>2025-06-09 04:38:28 -0400
commit06a2ef92bd8e35dccad318f264c396623a1b6536 (patch)
treef92531b18359fa157a068297a459cf459d6ed163 /sys/kern
parentc31bc1b4132d12d5cfb144419f83f480ee4e7b88 (diff)
kernel: stat: Fix getattr result pointer
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/vfs_syscalls.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 990d722..cd955c8 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -39,11 +39,13 @@
#include <sys/filedesc.h>
#include <string.h>
+#include <sys/panic.h>
+
static int
vfs_dostat(const char *path, struct stat *sbuf)
{
char pathbuf[PATH_MAX];
- struct vattr *attr;
+ struct vattr attr;
struct stat st;
struct vnode *vp;
struct vop_getattr_args gattr;
@@ -67,18 +69,18 @@ vfs_dostat(const char *path, struct stat *sbuf)
vp = nd.vp;
gattr.vp = vp;
+ gattr.res = &attr;
error = vfs_vop_getattr(vp, &gattr);
if (error != 0) {
return error;
}
- attr = gattr.res;
memset(&st, VNOVAL, sizeof(st));
/* Copy stat data to userspace statbuf */
- st.st_mode = attr->mode;
- st.st_size = attr->size;
+ st.st_mode = attr.mode;
+ st.st_size = attr.size;
copyout(&st, sbuf, sizeof(*sbuf));
return 0;
}