summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fs.rs2
-rw-r--r--src/handlers.rs9
-rw-r--r--src/msg.fbs4
3 files changed, 8 insertions, 7 deletions
diff --git a/src/fs.rs b/src/fs.rs
index 33323b87b..efc8b91b1 100644
--- a/src/fs.rs
+++ b/src/fs.rs
@@ -80,7 +80,7 @@ pub fn mkdir(path: &Path, perm: u32) -> std::io::Result<()> {
#[cfg(any(unix))]
fn set_dir_permission(builder: &mut DirBuilder, perm: u32) {
debug!("set dir perm to {}", perm);
- builder.mode(perm);
+ builder.mode(perm & 0o777);
}
#[cfg(not(any(unix)))]
diff --git a/src/handlers.rs b/src/handlers.rs
index f13ecec9f..9c218827f 100644
--- a/src/handlers.rs
+++ b/src/handlers.rs
@@ -533,13 +533,13 @@ macro_rules! to_seconds {
}
#[cfg(any(unix))]
-fn get_mode(perm: fs::Permissions) -> i32 {
- (perm.mode() as i32)
+fn get_mode(perm: fs::Permissions) -> u32 {
+ perm.mode()
}
#[cfg(not(any(unix)))]
-fn get_mode(_perm: fs::Permissions) -> i32 {
- -1
+fn get_mode(_perm: fs::Permissions) -> u32 {
+ 0
}
fn handle_stat(_d: *const DenoC, base: &msg::Base) -> Box<Op> {
@@ -568,6 +568,7 @@ fn handle_stat(_d: *const DenoC, base: &msg::Base) -> Box<Op> {
accessed: to_seconds!(metadata.accessed()),
created: to_seconds!(metadata.created()),
mode: get_mode(metadata.permissions()),
+ has_mode: cfg!(target_family = "unix"),
..Default::default()
},
);
diff --git a/src/msg.fbs b/src/msg.fbs
index e80713236..37a48e2df 100644
--- a/src/msg.fbs
+++ b/src/msg.fbs
@@ -212,8 +212,8 @@ table StatRes {
modified:ulong;
accessed:ulong;
created:ulong;
- mode: int = -1;
- // negative mode for invalid (Windows); default to invalid
+ mode: uint;
+ has_mode: bool; // false on windows
}
root_type Base;