diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-07-10 10:33:15 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-07-11 22:39:40 -0700 |
| commit | ca0b65402b107a8d357225945876783fa28122c6 (patch) | |
| tree | 557e1336d62e2ff59c1babb3176a528f6fd97250 /src/libstd | |
| parent | c26cd9f05dc20eb67cf90d2ebb18728807b53022 (diff) | |
| download | rust-ca0b65402b107a8d357225945876783fa28122c6.tar.gz rust-ca0b65402b107a8d357225945876783fa28122c6.zip | |
libc: Switch open to use a mode_t on unix
While I'm at it, export O_SYNC with the other flags that are exported. Closes #15582
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/io/fs.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libstd/io/fs.rs b/src/libstd/io/fs.rs index ed183cbf3bc..74ab19d0aa6 100644 --- a/src/libstd/io/fs.rs +++ b/src/libstd/io/fs.rs @@ -330,6 +330,11 @@ pub fn lstat(path: &Path) -> IoResult<FileStat> { } fn from_rtio(s: rtio::FileStat) -> FileStat { + #[cfg(windows)] + type Mode = libc::c_int; + #[cfg(unix)] + type Mode = libc::mode_t; + let rtio::FileStat { size, kind, perm, created, modified, accessed, device, inode, rdev, @@ -338,7 +343,7 @@ fn from_rtio(s: rtio::FileStat) -> FileStat { FileStat { size: size, - kind: match (kind as libc::c_int) & libc::S_IFMT { + kind: match (kind as Mode) & libc::S_IFMT { libc::S_IFREG => io::TypeFile, libc::S_IFDIR => io::TypeDirectory, libc::S_IFIFO => io::TypeNamedPipe, |
