homectl: add argument comments

This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2026-01-13 17:59:54 +01:00
parent edd2a2a006
commit f2c3ef9678
+12 -12
View File
@@ -1507,7 +1507,7 @@ static int create_home_common(sd_json_variant *input, bool show_enforce_password
_cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL;
_cleanup_(erase_and_freep) char *formatted = NULL;
r = sd_json_variant_format(hr->json, 0, &formatted);
r = sd_json_variant_format(hr->json, /* flags= */ 0, &formatted);
if (r < 0)
return log_error_errno(r, "Failed to format user record: %m");
@@ -1563,7 +1563,7 @@ static int create_home(int argc, char *argv[], void *userdata) {
if (argc >= 2) {
/* If a username was specified, use it */
if (valid_user_group_name(argv[1], 0))
if (valid_user_group_name(argv[1], /* flags= */ 0))
r = sd_json_variant_set_field_string(&arg_identity_extra, "userName", argv[1]);
else {
_cleanup_free_ char *un = NULL, *rr = NULL;
@@ -1966,7 +1966,7 @@ static int update_home(int argc, char *argv[], void *userdata) {
if (r < 0)
return bus_log_create_error(r);
r = sd_json_variant_format(hr->json, 0, &formatted);
r = sd_json_variant_format(hr->json, /* flags= */ 0, &formatted);
if (r < 0)
return log_error_errno(r, "Failed to format user record: %m");
@@ -2552,7 +2552,7 @@ static int create_or_register_from_credentials(void) {
else
continue;
if (!valid_user_group_name(e, 0)) {
if (!valid_user_group_name(e, /* flags= */ 0)) {
log_notice("Skipping over credential with name that is not a suitable user name: %s", de->d_name);
continue;
}
@@ -3144,7 +3144,7 @@ static int parse_home_directory_field(sd_json_variant **identity, const char *fi
assert(field);
if (!isempty(arg)) {
r = parse_path_argument(arg, false, &hd);
r = parse_path_argument(arg, /* suppress_root= */ false, &hd);
if (r < 0)
return r;
@@ -3180,7 +3180,7 @@ static int parse_path_field(sd_json_variant **identity, const char *field, const
assert(field);
if (!isempty(arg)) {
r = parse_path_argument(arg, false, &v);
r = parse_path_argument(arg, /* suppress_root= */ false, &v);
if (r < 0)
return r;
}
@@ -3648,7 +3648,7 @@ static int parse_language_field(char ***languages, const char *arg) {
for (const char *p = arg;;) {
_cleanup_free_ char *word = NULL;
r = extract_first_word(&p, &word, ",:", 0);
r = extract_first_word(&p, &word, ",:", /* flags= */ 0);
if (r < 0)
return log_error_errno(r, "Failed to parse locale list: %m");
if (r == 0)
@@ -3685,13 +3685,13 @@ static int parse_group_field(
_cleanup_free_ char *word = NULL;
_cleanup_strv_free_ char **list = NULL;
r = extract_first_word(&p, &word, ",", 0);
r = extract_first_word(&p, &word, ",", /* flags= */ 0);
if (r < 0)
return log_error_errno(r, "Failed to parse group list: %m");
if (r == 0)
return 0;
if (!valid_user_group_name(word, 0))
if (!valid_user_group_name(word, /* flags= */ 0))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Invalid group name %s.", word);
_cleanup_(sd_json_variant_unrefp) sd_json_variant *mo =
@@ -4844,7 +4844,7 @@ static int parse_argv(int argc, char *argv[]) {
eq = strrchr(optarg, '=');
if (!eq) { /* --blob=/some/path replaces the blob dir */
r = parse_path_argument(optarg, false, &arg_blob_dir);
r = parse_path_argument(optarg, /* suppress_root= */ false, &arg_blob_dir);
if (r < 0)
return log_error_errno(r, "Failed to parse path %s: %m", optarg);
break;
@@ -4860,7 +4860,7 @@ static int parse_argv(int argc, char *argv[]) {
if (!suitable_blob_filename(filename))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Invalid blob filename: %s", filename);
r = parse_path_argument(eq + 1, false, &path);
r = parse_path_argument(eq + 1, /* suppress_root= */ false, &path);
if (r < 0)
return log_error_errno(r, "Failed to parse path %s: %m", eq + 1);
} else {
@@ -4874,7 +4874,7 @@ static int parse_argv(int argc, char *argv[]) {
if (!filename)
return log_oom();
r = parse_path_argument(optarg, false, &path);
r = parse_path_argument(optarg, /* suppress_root= */ false, &path);
if (r < 0)
return log_error_errno(r, "Failed to parse path %s: %m", optarg);
}