diff options
Diffstat (limited to 'vendor/filetime')
-rw-r--r-- | vendor/filetime/.cargo-checksum.json | 2 | ||||
-rw-r--r-- | vendor/filetime/Cargo.toml | 2 | ||||
-rw-r--r-- | vendor/filetime/src/unix/linux.rs | 33 | ||||
-rw-r--r-- | vendor/filetime/src/unix/mod.rs | 15 |
4 files changed, 33 insertions, 19 deletions
diff --git a/vendor/filetime/.cargo-checksum.json b/vendor/filetime/.cargo-checksum.json index 8d7b7ce7d..7bc0e0ce1 100644 --- a/vendor/filetime/.cargo-checksum.json +++ b/vendor/filetime/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"c82074c47610281bf7c3de20e143b8795ac39543df6c52e86e96506f7747e93f","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"6cd295d9f4efe412971b1855ecaf7b19ef3956006a652ea205c456a5d33550c1","src/lib.rs":"eec6b5e3be2c1d5e068a9724b503e729a1e11dae4cd1bc816110c94a0bc14fa0","src/redox.rs":"898997b73c20818cf4601a1f4bcdf1b7dbf3b5d9d071cdc9fce5d1652f6bfc43","src/unix/android.rs":"d929826a9a92003b7aaa6435adc220efbb70c15308f9eed5ee517d88451fcaf6","src/unix/linux.rs":"061f0f7bd7a41f29b9d24b6487e302d650e9399f0dcc54595211e20ae4945da6","src/unix/macos.rs":"1b19a24bee240aba8d564405991bb0ee36ba72217461c8ac6829144d28f7e046","src/unix/mod.rs":"d6a4ae02099c46874e13c9fe71103cdecc394467e6c443950d27488ce9ec927b","src/unix/utimensat.rs":"0876aa32393689fcb5eec913c5d34954956a715913d611749b04243a2dbcf897","src/unix/utimes.rs":"d2d8ca5daed3d1ec0a0aed1fc03450deb4b7f1fcdb96ed40b8d2cfefd0e827ee","src/wasm.rs":"a82734259846a3349d42da011c1065d21f3981bd20d6eb43495e34808b83af9a","src/windows.rs":"3314a0def8028d8f2a4bc01377d5874ab9ddf8684aad13573c89b427bf2d9911"},"package":"4b9663d381d07ae25dc88dbdf27df458faa83a9b25336bcac83d5e452b5fc9d3"}
\ No newline at end of file +{"files":{"Cargo.toml":"47fb14a283873b721e1cafb0b68f25c761b513927ee6e203426de090e2299251","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"6cd295d9f4efe412971b1855ecaf7b19ef3956006a652ea205c456a5d33550c1","src/lib.rs":"eec6b5e3be2c1d5e068a9724b503e729a1e11dae4cd1bc816110c94a0bc14fa0","src/redox.rs":"898997b73c20818cf4601a1f4bcdf1b7dbf3b5d9d071cdc9fce5d1652f6bfc43","src/unix/android.rs":"d929826a9a92003b7aaa6435adc220efbb70c15308f9eed5ee517d88451fcaf6","src/unix/linux.rs":"648498bdf715766eeffdc2dff6a58db51cf6b244c431a6d53c33cbc73f1998d4","src/unix/macos.rs":"1b19a24bee240aba8d564405991bb0ee36ba72217461c8ac6829144d28f7e046","src/unix/mod.rs":"52512c922e1dbb47a6c7f0354c6198ca1ac61ea4d540bc0d73d3a3fd08908ba1","src/unix/utimensat.rs":"0876aa32393689fcb5eec913c5d34954956a715913d611749b04243a2dbcf897","src/unix/utimes.rs":"d2d8ca5daed3d1ec0a0aed1fc03450deb4b7f1fcdb96ed40b8d2cfefd0e827ee","src/wasm.rs":"a82734259846a3349d42da011c1065d21f3981bd20d6eb43495e34808b83af9a","src/windows.rs":"3314a0def8028d8f2a4bc01377d5874ab9ddf8684aad13573c89b427bf2d9911"},"package":"4e884668cd0c7480504233e951174ddc3b382f7c2666e3b7310b5c4e7b0c37f9"}
\ No newline at end of file diff --git a/vendor/filetime/Cargo.toml b/vendor/filetime/Cargo.toml index ba219b3e5..2d41405ab 100644 --- a/vendor/filetime/Cargo.toml +++ b/vendor/filetime/Cargo.toml @@ -12,7 +12,7 @@ [package] edition = "2018" name = "filetime" -version = "0.2.18" +version = "0.2.19" authors = ["Alex Crichton <alex@alexcrichton.com>"] description = """ Platform-agnostic accessors of timestamps in File metadata diff --git a/vendor/filetime/src/unix/linux.rs b/vendor/filetime/src/unix/linux.rs index c803e0217..255fcfb61 100644 --- a/vendor/filetime/src/unix/linux.rs +++ b/vendor/filetime/src/unix/linux.rs @@ -34,6 +34,11 @@ pub fn set_file_handle_times( static INVALID: AtomicBool = AtomicBool::new(false); if !INVALID.load(SeqCst) { let times = [super::to_timespec(&atime), super::to_timespec(&mtime)]; + + // We normally use a syscall because the `utimensat` function is documented + // as not accepting a file descriptor in the first argument (even though, on + // Linux, the syscall itself can accept a file descriptor there). + #[cfg(not(target_env = "musl"))] let rc = unsafe { libc::syscall( libc::SYS_utimensat, @@ -43,6 +48,24 @@ pub fn set_file_handle_times( 0, ) }; + // However, on musl, we call the musl libc function instead. This is because + // on newer musl versions starting with musl 1.2, `timespec` is always a 64-bit + // value even on 32-bit targets. As a result, musl internally converts their + // `timespec` values to the correct ABI before invoking the syscall. Since we + // use `timespec` from the libc crate, it matches musl's definition and not + // the Linux kernel's version (for some platforms) so we must use musl's + // `utimensat` function to properly convert the value. musl's `utimensat` + // function allows file descriptors in the path argument so this is fine. + #[cfg(target_env = "musl")] + let rc = unsafe { + libc::utimensat( + f.as_raw_fd(), + ptr::null::<libc::c_char>(), + times.as_ptr(), + 0, + ) + }; + if rc == 0 { return Ok(()); } @@ -78,15 +101,7 @@ fn set_times( if !INVALID.load(SeqCst) { let p = CString::new(p.as_os_str().as_bytes())?; let times = [super::to_timespec(&atime), super::to_timespec(&mtime)]; - let rc = unsafe { - libc::syscall( - libc::SYS_utimensat, - libc::AT_FDCWD, - p.as_ptr(), - times.as_ptr(), - flags, - ) - }; + let rc = unsafe { libc::utimensat(libc::AT_FDCWD, p.as_ptr(), times.as_ptr(), flags) }; if rc == 0 { return Ok(()); } diff --git a/vendor/filetime/src/unix/mod.rs b/vendor/filetime/src/unix/mod.rs index 8b7788837..df62de429 100644 --- a/vendor/filetime/src/unix/mod.rs +++ b/vendor/filetime/src/unix/mod.rs @@ -58,17 +58,16 @@ fn to_timespec(ft: &Option<FileTime>) -> timespec { } } + let mut ts: timespec = unsafe { std::mem::zeroed() }; if let &Some(ft) = ft { - timespec { - tv_sec: ft.seconds() as time_t, - tv_nsec: ft.nanoseconds() as _, - } + ts.tv_sec = ft.seconds() as time_t; + ts.tv_nsec = ft.nanoseconds() as _; } else { - timespec { - tv_sec: 0, - tv_nsec: UTIME_OMIT as _, - } + ts.tv_sec = 0; + ts.tv_nsec = UTIME_OMIT as _; } + + ts } pub fn from_last_modification_time(meta: &fs::Metadata) -> FileTime { |