diff --git a/src/fs/mod.rs b/src/fs/mod.rs index ad960a98ea..16d59c064e 100644 --- a/src/fs/mod.rs +++ b/src/fs/mod.rs @@ -371,11 +371,8 @@ pub unsafe fn create_file( } /// Creates a new, empty directory at the provided path -pub fn create_dir(path: &str) -> Result<(), IoError> { - FILESYSTEM - .get() - .unwrap() - .mkdir(path, AccessPermission::from_bits(0o777).unwrap()) +pub fn create_dir(path: &str, mode: AccessPermission) -> Result<(), IoError> { + FILESYSTEM.get().unwrap().mkdir(path, mode) } /// Returns an vector with all the entries within a directory. diff --git a/src/syscalls/mod.rs b/src/syscalls/mod.rs index e1fc3809db..88d429ffa4 100644 --- a/src/syscalls/mod.rs +++ b/src/syscalls/mod.rs @@ -317,11 +317,7 @@ pub unsafe extern "C" fn sys_mkdir(name: *const u8, mode: u32) -> i32 { return -crate::errno::EINVAL; }; - fs::FILESYSTEM - .get() - .unwrap() - .mkdir(name, mode) - .map_or_else(|e| -num::ToPrimitive::to_i32(&e).unwrap(), |_| 0) + crate::fs::create_dir(name, mode).map_or_else(|e| -num::ToPrimitive::to_i32(&e).unwrap(), |_| 0) } #[hermit_macro::system]