Merge remote-tracking branch 'origin/feat/chmod' into dev
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "client_send.h"
|
||||
#include "client_validation.h"
|
||||
#include "chmod.h"
|
||||
#include "config.h"
|
||||
#include "delta.h"
|
||||
#include "log.h"
|
||||
@@ -231,6 +232,7 @@ static const OptionEntry OPTION_TABLE[] = {
|
||||
{"--8-bit-output", "-8", OPT_FLAG, offsetof(Config, eight_bit_output)},
|
||||
{"--existing", NULL, OPT_FLAG, offsetof(Config, existing)},
|
||||
{"--ignore-existing", NULL, OPT_FLAG, offsetof(Config, ignore_existing)},
|
||||
{"--chmod", NULL, OPT_STRING, offsetof(Config, chmod_spec)},
|
||||
|
||||
{"--source-dir", NULL, OPT_STRING, offsetof(Config, send_directory)},
|
||||
{"--dest-dir", NULL, OPT_STRING, offsetof(Config, receive_root_directory)},
|
||||
@@ -319,6 +321,14 @@ int parse_args(Config* config, int argc, char* argv[], int* positional_args,
|
||||
}
|
||||
if (apply_table_option(config, entry, argv[++i]) != 0)
|
||||
return -1;
|
||||
if (entry->offset == offsetof(Config, chmod_spec)) {
|
||||
mode_t ignored;
|
||||
if (!chmod_apply(0, config->chmod_spec, &ignored)) {
|
||||
log_message(LOG_LEVEL_ERROR, "--chmod has invalid permission changes");
|
||||
return -1;
|
||||
}
|
||||
config->use_metadata = true;
|
||||
}
|
||||
} else if (apply_table_option(config, entry, NULL) != 0) {
|
||||
return -1;
|
||||
}
|
||||
@@ -327,6 +337,18 @@ int parse_args(Config* config, int argc, char* argv[], int* positional_args,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strncmp(argv[i], "--chmod=", 8) == 0) {
|
||||
if (set_string_option(&config->chmod_spec, argv[i] + 8, "--chmod") != 0)
|
||||
return -1;
|
||||
mode_t ignored;
|
||||
if (!chmod_apply(0, config->chmod_spec, &ignored)) {
|
||||
log_message(LOG_LEVEL_ERROR, "--chmod has invalid permission changes");
|
||||
return -1;
|
||||
}
|
||||
config->use_metadata = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (opt_is(argv[i], "--help", NULL)) {
|
||||
print_usage();
|
||||
return 1;
|
||||
|
||||
@@ -51,6 +51,7 @@ void print_usage(void) {
|
||||
printf(" --debug=FLAGS Fine-grained debug logging (use --debug=help for flags)\n");
|
||||
printf(" -M, --preserve Preserve file metadata\n");
|
||||
printf(" -E, --executability Preserve executable permission bits\n");
|
||||
printf(" --chmod <changes> Modify transferred permissions (rsync syntax)\n");
|
||||
printf(" --chunk-size <n> Chunk size in bytes (default: %d)\n", DEFAULT_CHUNK_SIZE);
|
||||
printf(" --source-dir <path> Source directory\n");
|
||||
printf(" --dest-dir <path> Destination directory\n");
|
||||
|
||||
Reference in New Issue
Block a user