diff options
author | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2019-03-02 17:40:15 -0500 |
---|---|---|
committer | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2019-03-02 17:40:15 -0500 |
commit | d6e7cbd70841fa2c31181cb3d9588dcaf2a32ede (patch) | |
tree | 5e789a50d92605b46a62cfd12f86f9dfb4473068 | |
parent | 68e20a4c0b4696b605efea06dc3fabd8f7740349 (diff) |
make some code less linux-specific
-rw-r--r-- | src/commands/set_mode.rs | 3 | ||||
-rw-r--r-- | src/unix.rs | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/commands/set_mode.rs b/src/commands/set_mode.rs index ee7efd8..56be5e5 100644 --- a/src/commands/set_mode.rs +++ b/src/commands/set_mode.rs @@ -51,7 +51,8 @@ impl SetMode { let mut mode: u32 = 0; for (i, ch) in s.chars().enumerate() { if ch == LIBC_PERMISSION_VALS[i].1 { - mode |= LIBC_PERMISSION_VALS[i].0; + let val: u32 = LIBC_PERMISSION_VALS[i].0.into(); + mode |= val; } } unix::set_mode(entry.path.as_path(), mode); diff --git a/src/unix.rs b/src/unix.rs index b819843..0fd2b8a 100644 --- a/src/unix.rs +++ b/src/unix.rs @@ -87,7 +87,7 @@ pub fn set_mode(path: &Path, mode: u32) { if let Some(s) = os_path.to_str() { let svec: Vec<i8> = s.bytes().map(|ch| ch as i8).collect(); unsafe { - libc::chmod(svec.as_ptr(), mode); + libc::chmod(svec.as_ptr(), mode.into()); } } } |