--- source3/utils/smbget.c.orig 2010-01-27 11:38:14.927686692 +0100 +++ source3/utils/smbget.c 2010-01-27 14:13:30.315445279 +0100 @@ -51,6 +51,7 @@ static int smb_download_file(const char *base, const char *name, int recursive, int resume, char *outfile); +/* result 0 indicates error */ static int get_num_cols(void) { #ifdef TIOCGWINSZ @@ -116,6 +117,7 @@ free(wgtmp); free(usertmp); } +/* result 0 indicates error */ static int smb_download_dir(const char *base, const char *name, int resume) { char path[SMB_MAXPATHLEN]; @@ -258,6 +260,7 @@ free(filename); free(status); } +/* result 0 indicates error */ static int smb_download_file(const char *base, const char *name, int recursive, int resume, char *outfile) { int remotehandle, localhandle; time_t start_time = time(NULL); @@ -279,8 +282,7 @@ fprintf(stderr, "%s is a directory. Specify -R to download recursively\n", path); return 0; } - smb_download_dir(base, name, resume); - return 0; + return smb_download_dir(base, name, resume); case ENOENT: fprintf(stderr, "%s can't be found on the remote server\n", path); @@ -326,7 +328,7 @@ if(verbose) printf("%s is up-to-date, skipping\n", newpath); smbc_close(remotehandle); - return 0; + return 1; /* NOOP, not regarded as error */ } /* else open it for writing and truncate if it exists */ localhandle = open(newpath, O_CREAT | O_NONBLOCK | O_RDWR | O_TRUNC, 0775); @@ -499,6 +501,7 @@ clean_exit(); } +/* return code 0 = ok */ static int readrcfile(const char *name, const struct poptOption long_options[]) { FILE *fd = fopen(name, "r"); @@ -652,9 +655,9 @@ while ( (file = poptGetArg(pc)) ) { if (!recursive) - return smb_download_file(file, "", recursive, resume, outputfile); + return ! smb_download_file(file, "", recursive, resume, outputfile) ; else - return smb_download_dir(file, "", resume); + return ! smb_download_dir(file, "", resume) ; } clean_exit();