The Samba-Bugzilla – Bug 7069
smbget does not return an error status after some errors
Last modified: 2010-02-04 03:16:44 UTC
I realized that some error conditions are reported on the console but
the return code of smbget ist 0. This broke some scripts.
After looking into the code i think to have found a reason:
smb_download_file() and smb_download_dir() return 0 in case of error.
the return code of these functions is then returned from main where
1 means error and 0 means no error.
I will append a patch for this
Created attachment 5225 [details]
clean up smbget return status in case of some errors
I could build the samba-3.4.5 source tree with this patch.
smbget -WGROUP smb://server/share/nonexisting file || echo ARGHH
Will say "ARGHH"
Created attachment 5228 [details]
I re-wrote the patch somewhat. Convention is that 0 means success, != 0 means failure on UNIX so I changed the code to do this. Can you test this out in your environment and let me know if it works as a fix for you ?
Created attachment 5236 [details]
after applying Jeremies patch, applying this one made it work. clean_exit() always dows a "exit(0)", so no status code of 1 was issued
I will attach a cumulative patch also
Created attachment 5237 [details]
cumulative patch with Jeremies clean up patch and the patch above
Created attachment 5245 [details]
git-am format patch for 3.5.0.
Re-assigning to Karolin for inclusion in 3.5.x. Tested and checked by submitter.
Pushed to v3-5-test. Will be included in 3.5.0.
Closing out bug report.
Thanks a lot for testing and providing the patch!