This commit is contained in:
2024-08-23 18:51:04 -05:00
parent 3c0f5c2eff
commit 0b3e187daa

View File

@ -861,23 +861,22 @@ auto remote_server::fuse_utimens(const char *path, const remote::file_time *tv,
if (os_handle != INVALID_HANDLE_VALUE) {
FILETIME access_time{};
FILETIME write_time{};
FILETIME *access_time_ptr = nullptr;
FILETIME *write_time_ptr = nullptr;
FILETIME *access_time_ptr{nullptr};
FILETIME *write_time_ptr{nullptr};
const auto proccess_timespec = [](auto op, const auto &src, auto &dst,
auto *&dst_ptr) {
if ((src == 0U) || (op == UTIME_NOW)) {
auto now =
utils::time::unix_error_to_windows(utils::time::get_time_now());
dest.dwHighDateTime = static_cast<DWORD>((now >> 32U) & 0xFFFFFFFF);
dest.dwLowDateTime = now & 0xFFFFFFFF;
dst_ptr = &dest;
auto now = utils::unix_error_to_windows(utils::time::get_time_now());
dst.dwHighDateTime = static_cast<DWORD>((now >> 32U) & 0xFFFFFFFF);
dst.dwLowDateTime = now & 0xFFFFFFFF;
dst_ptr = &dst;
return;
}
if (op != UTIME_OMIT) {
dest = utils::time::unix_time_to_filetime(src);
dst_ptr = &dest;
dst = utils::time::unix_time_to_filetime(src);
dst_ptr = &dst;
}
};
proccess_timespec(op0, tv[0U], access_time, access_time_ptr);