From 68b396dfb62335ee9f92c25eb2577291243e10a9 Mon Sep 17 00:00:00 2001 From: Amir Abbas Mousavian Date: Fri, 1 Dec 2023 15:54:34 +0330 Subject: [PATCH] fix: Update libsmb2 submodule branch fix: fileDescriptor crash, compile error on time --- AMSMB2/Context.swift | 6 +++++- AMSMB2/FileHandle.swift | 16 ++++++++-------- Dependencies/libsmb2 | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) 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