bool nonprompt;
bool quiet;
bool dots;
- bool keep_permissions;
bool verbose;
bool send_stdout;
bool update;
struct smbc_dirent *dirent;
const char *relname = name;
char *tmpname;
- struct stat remotestat;
bool ok = false;
snprintf(path, SMB_MAXPATHLEN-1, "%s%s%s", base,
}
free(tmpname);
- if (opt.keep_permissions) {
- if (smbc_fstat(dirhandle, &remotestat) < 0) {
- fprintf(stderr,
- "Unable to get stats on %s on remote server\n",
- path);
- smbc_closedir(dirhandle);
- return false;
- }
-
- if (chmod(relname, remotestat.st_mode) < 0) {
- fprintf(stderr,
- "Unable to change mode of local dir %s to %o\n",
- relname, (unsigned int)remotestat.st_mode);
- smbc_closedir(dirhandle);
- return false;
- }
- }
-
smbc_closedir(dirhandle);
return ok;
}
fputc('\n', stderr);
}
- if (opt.keep_permissions && !opt.send_stdout) {
- if (fchmod(localhandle, remotestat.st_mode) < 0) {
- fprintf(stderr, "Unable to change mode of local "
- "file %s to %o\n",
- path, (unsigned int)remotestat.st_mode);
- smbc_close(remotehandle);
- close(localhandle);
- return false;
- }
- }
-
smbc_close(remotehandle);
if (localhandle != STDOUT_FILENO) {
close(localhandle);
{"resume", 'r', POPT_ARG_NONE, &resume, 0, "Automatically resume aborted files" },
{"update", 'u', POPT_ARG_NONE, &opt.update, 0, "Download only when remote file is newer than local file or local file is missing"},
{"recursive", 'R', POPT_ARG_NONE, &recursive, 0, "Recursively download files" },
- {"keep-permissions", 'P', POPT_ARG_NONE, &opt.keep_permissions, 'P', "Keep permissions" },
{"blocksize", 'b', POPT_ARG_INT, &opt.blocksize, 'b', "Change number of bytes in a block"},
{"outputfile", 'o', POPT_ARG_STRING, &opt.outputfile, 'o', "Write downloaded data to specified file" },