diff --git a/AMSMB2/Context.swift b/AMSMB2/Context.swift index 6103916..68843cf 100644 --- a/AMSMB2/Context.swift +++ b/AMSMB2/Context.swift @@ -169,7 +169,11 @@ extension SMB2Context { } var fileDescriptor: Int32 { - (try? smb2_get_fd(unsafe.unwrap())) ?? -1 + do { + return try smb2_get_fd(unsafe.unwrap()) + } catch { + return -1 + } } var error: String? { diff --git a/AMSMB2/FileHandle.swift b/AMSMB2/FileHandle.swift index 54fc346..8d7a1e3 100644 --- a/AMSMB2/FileHandle.swift +++ b/AMSMB2/FileHandle.swift @@ -130,17 +130,17 @@ final class SMB2FileHandle { context, cbPtr -> UnsafeMutablePointer? in var bfi = smb2_file_basic_info( creation_time: smb2_timeval( - tv_sec: UInt32(stat.smb2_btime), - tv_usec: UInt32(stat.smb2_btime_nsec) / 1000), + tv_sec: .init(stat.smb2_btime), + tv_usec: .init(stat.smb2_btime_nsec / 1000)), last_access_time: smb2_timeval( - tv_sec: UInt32(stat.smb2_atime), - tv_usec: UInt32(stat.smb2_atime_nsec) / 1000), + tv_sec: .init(stat.smb2_atime), + tv_usec: .init(stat.smb2_atime_nsec / 1000)), last_write_time: smb2_timeval( - tv_sec: UInt32(stat.smb2_mtime), - tv_usec: UInt32(stat.smb2_mtime_nsec) / 1000), + tv_sec: .init(stat.smb2_mtime), + tv_usec: .init(stat.smb2_mtime_nsec / 1000)), change_time: smb2_timeval( - tv_sec: UInt32(stat.smb2_ctime), - tv_usec: UInt32(stat.smb2_ctime_nsec) / 1000), + tv_sec: .init(stat.smb2_ctime), + tv_usec: .init(stat.smb2_ctime_nsec / 1000)), file_attributes: attributes.rawValue) var req = smb2_set_info_request() diff --git a/Dependencies/libsmb2 b/Dependencies/libsmb2 index dd26794..9c85477 160000 --- a/Dependencies/libsmb2 +++ b/Dependencies/libsmb2 @@ -1 +1 @@ -Subproject commit dd26794c4d46387a9d2405a7c391dfe2ff2972f9 +Subproject commit 9c85477d6282e06a39f620a2e9fa317d41f0cba6