diff options
Diffstat (limited to 'kernel/scalls/stat.c')
-rw-r--r-- | kernel/scalls/stat.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/kernel/scalls/stat.c b/kernel/scalls/stat.c index 0850151..9fc115b 100644 --- a/kernel/scalls/stat.c +++ b/kernel/scalls/stat.c @@ -5,9 +5,8 @@ int syscall_stat(SYS_STAT_PARAMS *args) { const char *pathname = copy_and_allocate_user_string(args->pathname); struct stat *statbuf = args->statbuf; - vfs_inode_t *i = vfs_internal_open(pathname); - if (!i) - return -ENOENT; - statbuf->st_size = i->file_size; - return 0; + int fd = vfs_open(pathname, O_READ, 0); + int rc = vfs_fstat(fd, statbuf); + vfs_close(fd); + return rc; } |