Skip to content

Commit d608135

Browse files
authored
Fix deprecation warnings on st_mtime etc. (#120)
To handle negative timestamps, rustix now provides extension trait methods to access these fields.
1 parent 0569f8a commit d608135

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

c-gull/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ libc = { version = "0.2.138", default-features = false }
1818
c-scape = { path = "../c-scape", version = "0.15.40", default-features = false }
1919
errno = { version = "0.3.3", default-features = false, optional = true }
2020
tz-rs = { version = "0.6.11", default-features = false, optional = true }
21-
rustix = { version = "0.38.23", default-features = false, optional = true, features = ["fs", "itoa", "net", "param", "process", "procfs", "rand", "termios", "thread", "time"] }
21+
rustix = { version = "0.38.31", default-features = false, optional = true, features = ["fs", "itoa", "net", "param", "process", "procfs", "rand", "termios", "thread", "time"] }
2222

2323
[features]
2424
default = ["thread", "std", "coexist-with-libc", "threadsafe-setenv", "use-compiler-builtins"]

c-scape/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ cc = { version = "1.0.68", optional = true }
1919

2020
[dependencies]
2121
libm = "0.2.1"
22-
rustix = { version = "0.38.27", default-features = false, features = ["event", "fs", "itoa", "mm", "net", "param", "pipe", "process", "rand", "runtime", "shm", "stdio", "system", "termios", "thread", "time"] }
22+
rustix = { version = "0.38.31", default-features = false, features = ["event", "fs", "itoa", "mm", "net", "param", "pipe", "process", "rand", "runtime", "shm", "stdio", "system", "termios", "thread", "time"] }
2323
rustix-futex-sync = { version = "0.2.1", features = ["atomic_usize"] }
2424
memoffset = "0.9.0"
2525
realpath-ext = { version = "0.1.0", default-features = false }

c-scape/src/fs/stat.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use core::ptr::{addr_of, addr_of_mut, copy_nonoverlapping};
55
use errno::{set_errno, Errno};
66
use libc::{c_char, c_int, time_t};
77
use rustix::fd::BorrowedFd;
8-
use rustix::fs::AtFlags;
8+
use rustix::fs::{AtFlags, StatExt};
99

1010
use crate::convert_res;
1111

@@ -24,11 +24,11 @@ fn rustix_stat_to_libc_stat(
2424
stat.st_size = rustix_stat.st_size.try_into()?;
2525
stat.st_blksize = rustix_stat.st_blksize.try_into()?;
2626
stat.st_blocks = rustix_stat.st_blocks.try_into()?;
27-
stat.st_atime = rustix_stat.st_atime.try_into()?;
27+
stat.st_atime = rustix_stat.atime().try_into()?;
2828
stat.st_atime_nsec = rustix_stat.st_atime_nsec.try_into()?;
29-
stat.st_mtime = rustix_stat.st_mtime.try_into()?;
29+
stat.st_mtime = rustix_stat.mtime().try_into()?;
3030
stat.st_mtime_nsec = rustix_stat.st_mtime_nsec.try_into()?;
31-
stat.st_ctime = rustix_stat.st_ctime as time_t;
31+
stat.st_ctime = rustix_stat.ctime() as time_t;
3232
stat.st_ctime_nsec = rustix_stat.st_ctime_nsec.try_into()?;
3333
Ok(stat)
3434
}

0 commit comments

Comments
 (0)