Merge remote-tracking branch 'origin/feat/chmod' into dev

This commit is contained in:
2026-09-04 18:20:08 +02:00
parent 315e572d18
commit 4f21498ee6
11 changed files with 229 additions and 10 deletions
+22
View File
@@ -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;