Skip to content

Commit

Permalink
Merge pull request #57 from redbug26/master
Browse files Browse the repository at this point in the history
Fix smb_tree_connect return
  • Loading branch information
TimOliver authored Jan 5, 2018
2 parents d74ae80 + 6b1ba6a commit ec29ff1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions TOSMBClient.podspec
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
3 changes: 1 addition & 2 deletions TOSMBClient/TOSMBSession.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions TOSMBClient/TOSMBSessionDownloadTask.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions TOSMBClient/TOSMBSessionUploadTask.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ec29ff1

Please sign in to comment.