From 6b1ba6aa646d6e147d3c074e714e2039058967d5 Mon Sep 17 00:00:00 2001 From: RedBug Date: Thu, 4 Jan 2018 11:55:27 +0100 Subject: [PATCH] Fix smb_tree_connect return --- TOSMBClient.podspec | 4 ++-- TOSMBClient/TOSMBSession.m | 3 +-- TOSMBClient/TOSMBSessionDownloadTask.m | 4 ++-- TOSMBClient/TOSMBSessionUploadTask.m | 4 ++-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/TOSMBClient.podspec b/TOSMBClient.podspec index 6c78c28..e1cd0bc 100644 --- a/TOSMBClient.podspec +++ b/TOSMBClient.podspec @@ -1,11 +1,11 @@ Pod::Spec.new do |s| s.name = 'TOSMBClient' - s.version = '1.0.8' + s.version = '1.0.9' s.license = { :type => 'MIT', :file => 'LICENSE.md' } s.summary = 'An Objective-C framework that wraps libdsm, an SMB client library.' s.homepage = 'https://github.com/TimOliver/TOSMBClient' s.author = 'Tim Oliver' - s.source = { :git => 'https://github.com/TimOliver/TOSMBClient.git', :tag => '1.0.8' } + s.source = { :git => 'https://github.com/TimOliver/TOSMBClient.git', :tag => '1.0.9' } s.platform = :ios, '7.0' s.source_files = 'TOSMBClient/**/*.{h,m}' s.vendored_libraries = 'TOSMBClient/libdsm/libdsm.a', 'TOSMBClient/libdsm/libtasn1.a' diff --git a/TOSMBClient/TOSMBSession.m b/TOSMBClient/TOSMBSession.m index 59c95c2..9361199 100644 --- a/TOSMBClient/TOSMBSession.m +++ b/TOSMBClient/TOSMBSession.m @@ -289,8 +289,7 @@ - (NSArray *)requestContentsOfDirectoryAtFilePath:(NSString *)path error:(NSErro //If not, make a new connection const char *cStringName = [shareName cStringUsingEncoding:NSUTF8StringEncoding]; smb_tid shareID = -1; - smb_tree_connect(self.session, cStringName, &shareID); - if (shareID < 0) { + if (smb_tree_connect(self.session, cStringName, &shareID) != 0) { if (error) { resultError = errorForErrorCode(TOSMBSessionErrorCodeShareConnectionFailed); *error = resultError; diff --git a/TOSMBClient/TOSMBSessionDownloadTask.m b/TOSMBClient/TOSMBSessionDownloadTask.m index 55f6c58..cbad7c4 100644 --- a/TOSMBClient/TOSMBSessionDownloadTask.m +++ b/TOSMBClient/TOSMBSessionDownloadTask.m @@ -293,8 +293,8 @@ - (void)performTaskWithOperation:(__weak NSBlockOperation *)weakOperation //Next attach to the share we'll be using NSString *shareName = [self.session shareNameFromPath:self.sourceFilePath]; const char *shareCString = [shareName cStringUsingEncoding:NSUTF8StringEncoding]; - smb_tree_connect(self.smbSession, shareCString, &treeID); - if (!treeID) { + + if (smb_tree_connect(self.smbSession, shareCString, &treeID) != 0) { [self didFailWithError:errorForErrorCode(TOSMBSessionErrorCodeShareConnectionFailed)]; self.cleanupBlock(treeID, fileID); return; diff --git a/TOSMBClient/TOSMBSessionUploadTask.m b/TOSMBClient/TOSMBSessionUploadTask.m index 2c6fd3c..adeb4b3 100644 --- a/TOSMBClient/TOSMBSessionUploadTask.m +++ b/TOSMBClient/TOSMBSessionUploadTask.m @@ -138,8 +138,8 @@ - (void)performTaskWithOperation:(NSBlockOperation * _Nonnull __weak)weakOperati //Next attach to the share we'll be using NSString *shareName = [self.session shareNameFromPath:self.path]; const char *shareCString = [shareName cStringUsingEncoding:NSUTF8StringEncoding]; - smb_tree_connect(self.smbSession, shareCString, &treeID); - if (!treeID) { + + if (smb_tree_connect(self.smbSession, shareCString, &treeID) != 0) { [self didFailWithError:errorForErrorCode(TOSMBSessionErrorCodeShareConnectionFailed)]; self.cleanupBlock(treeID, fileID); return;