serialize: change order of deserialize_strv() parameters
The other deserializers put value first, and return parameter second, let's do so here too.
This commit is contained in:
@@ -1008,11 +1008,11 @@ static int exec_cgroup_context_deserialize(CGroupContext *c, FILE *f) {
|
||||
return r;
|
||||
c->ip_address_deny_reduced = r;
|
||||
} else if ((val = startswith(l, "exec-cgroup-context-ip-ingress-filter-path="))) {
|
||||
r = deserialize_strv(&c->ip_filters_ingress, val);
|
||||
r = deserialize_strv(val, &c->ip_filters_ingress);
|
||||
if (r < 0)
|
||||
return r;
|
||||
} else if ((val = startswith(l, "exec-cgroup-context-ip-egress-filter-path="))) {
|
||||
r = deserialize_strv(&c->ip_filters_egress, val);
|
||||
r = deserialize_strv(val, &c->ip_filters_egress);
|
||||
if (r < 0)
|
||||
return r;
|
||||
} else if ((val = startswith(l, "exec-cgroup-context-bpf-program="))) {
|
||||
@@ -1544,7 +1544,7 @@ static int exec_parameters_deserialize(ExecParameters *p, FILE *f, FDSet *fds) {
|
||||
if (p->runtime_scope < 0)
|
||||
return p->runtime_scope;
|
||||
} else if ((val = startswith(l, "exec-parameters-environment="))) {
|
||||
r = deserialize_strv(&p->environment, val);
|
||||
r = deserialize_strv(val, &p->environment);
|
||||
if (r < 0)
|
||||
return r;
|
||||
} else if ((val = startswith(l, "exec-parameters-n-socket-fds="))) {
|
||||
@@ -1604,7 +1604,7 @@ static int exec_parameters_deserialize(ExecParameters *p, FILE *f, FDSet *fds) {
|
||||
p->fds[i] = fd;
|
||||
}
|
||||
} else if ((val = startswith(l, "exec-parameters-fd-names="))) {
|
||||
r = deserialize_strv(&p->fd_names, val);
|
||||
r = deserialize_strv(val, &p->fd_names);
|
||||
if (r < 0)
|
||||
return r;
|
||||
} else if ((val = startswith(l, "exec-parameters-flags="))) {
|
||||
@@ -1780,7 +1780,7 @@ static int exec_parameters_deserialize(ExecParameters *p, FILE *f, FDSet *fds) {
|
||||
|
||||
p->user_lookup_fd = fd;
|
||||
} else if ((val = startswith(l, "exec-parameters-files-env="))) {
|
||||
r = deserialize_strv(&p->files_env, val);
|
||||
r = deserialize_strv(val, &p->files_env);
|
||||
if (r < 0)
|
||||
return r;
|
||||
} else if ((val = startswith(l, "exec-parameters-unit-id="))) {
|
||||
@@ -2730,19 +2730,19 @@ static int exec_context_deserialize(ExecContext *c, FILE *f) {
|
||||
break;
|
||||
|
||||
if ((val = startswith(l, "exec-context-environment="))) {
|
||||
r = deserialize_strv(&c->environment, val);
|
||||
r = deserialize_strv(val, &c->environment);
|
||||
if (r < 0)
|
||||
return r;
|
||||
} else if ((val = startswith(l, "exec-context-environment-files="))) {
|
||||
r = deserialize_strv(&c->environment_files, val);
|
||||
r = deserialize_strv(val, &c->environment_files);
|
||||
if (r < 0)
|
||||
return r;
|
||||
} else if ((val = startswith(l, "exec-context-pass-environment="))) {
|
||||
r = deserialize_strv(&c->pass_environment, val);
|
||||
r = deserialize_strv(val, &c->pass_environment);
|
||||
if (r < 0)
|
||||
return r;
|
||||
} else if ((val = startswith(l, "exec-context-unset-environment="))) {
|
||||
r = deserialize_strv(&c->unset_environment, val);
|
||||
r = deserialize_strv(val, &c->unset_environment);
|
||||
if (r < 0)
|
||||
return r;
|
||||
} else if ((val = startswith(l, "exec-context-working-directory="))) {
|
||||
@@ -3288,7 +3288,7 @@ static int exec_context_deserialize(ExecContext *c, FILE *f) {
|
||||
return r;
|
||||
c->dynamic_user = r;
|
||||
} else if ((val = startswith(l, "exec-context-supplementary-groups="))) {
|
||||
r = deserialize_strv(&c->supplementary_groups, val);
|
||||
r = deserialize_strv(val, &c->supplementary_groups);
|
||||
if (r < 0)
|
||||
return r;
|
||||
} else if ((val = startswith(l, "exec-context-set-login-environment="))) {
|
||||
@@ -3300,27 +3300,27 @@ static int exec_context_deserialize(ExecContext *c, FILE *f) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
} else if ((val = startswith(l, "exec-context-read-write-paths="))) {
|
||||
r = deserialize_strv(&c->read_write_paths, val);
|
||||
r = deserialize_strv(val, &c->read_write_paths);
|
||||
if (r < 0)
|
||||
return r;
|
||||
} else if ((val = startswith(l, "exec-context-read-only-paths="))) {
|
||||
r = deserialize_strv(&c->read_only_paths, val);
|
||||
r = deserialize_strv(val, &c->read_only_paths);
|
||||
if (r < 0)
|
||||
return r;
|
||||
} else if ((val = startswith(l, "exec-context-inaccessible-paths="))) {
|
||||
r = deserialize_strv(&c->inaccessible_paths, val);
|
||||
r = deserialize_strv(val, &c->inaccessible_paths);
|
||||
if (r < 0)
|
||||
return r;
|
||||
} else if ((val = startswith(l, "exec-context-exec-paths="))) {
|
||||
r = deserialize_strv(&c->exec_paths, val);
|
||||
r = deserialize_strv(val, &c->exec_paths);
|
||||
if (r < 0)
|
||||
return r;
|
||||
} else if ((val = startswith(l, "exec-context-no-exec-paths="))) {
|
||||
r = deserialize_strv(&c->no_exec_paths, val);
|
||||
r = deserialize_strv(val, &c->no_exec_paths);
|
||||
if (r < 0)
|
||||
return r;
|
||||
} else if ((val = startswith(l, "exec-context-exec-search-path="))) {
|
||||
r = deserialize_strv(&c->exec_search_path, val);
|
||||
r = deserialize_strv(val, &c->exec_search_path);
|
||||
if (r < 0)
|
||||
return r;
|
||||
} else if ((val = startswith(l, "exec-context-mount-propagation-flag="))) {
|
||||
@@ -3794,7 +3794,7 @@ static int exec_context_deserialize(ExecContext *c, FILE *f) {
|
||||
if (r < 0)
|
||||
return log_oom_debug();
|
||||
} else if ((val = startswith(l, "exec-context-extension-directories="))) {
|
||||
r = deserialize_strv(&c->extension_directories, val);
|
||||
r = deserialize_strv(val, &c->extension_directories);
|
||||
if (r < 0)
|
||||
return r;
|
||||
} else if ((val = startswith(l, "exec-context-set-credentials="))) {
|
||||
@@ -3938,7 +3938,7 @@ static int exec_command_deserialize(ExecCommand *c, FILE *f) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
} else if ((val = startswith(l, "exec-command-argv="))) {
|
||||
r = deserialize_strv(&c->argv, val);
|
||||
r = deserialize_strv(val, &c->argv);
|
||||
if (r < 0)
|
||||
return r;
|
||||
} else if ((val = startswith(l, "exec-command-flags="))) {
|
||||
|
||||
@@ -302,7 +302,7 @@ int deserialize_fd(FDSet *fds, const char *value) {
|
||||
return TAKE_FD(our_fd);
|
||||
}
|
||||
|
||||
int deserialize_strv(char ***l, const char *value) {
|
||||
int deserialize_strv(const char *value, char ***l) {
|
||||
ssize_t unescaped_len;
|
||||
char *unescaped;
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ int deserialize_fd(FDSet *fds, const char *value);
|
||||
int deserialize_usec(const char *value, usec_t *ret);
|
||||
int deserialize_dual_timestamp(const char *value, dual_timestamp *ret);
|
||||
int deserialize_environment(const char *value, char ***environment);
|
||||
int deserialize_strv(char ***l, const char *value);
|
||||
int deserialize_strv(const char *value, char ***l);
|
||||
int deserialize_pidref(FDSet *fds, const char *value, PidRef *ret);
|
||||
|
||||
int open_serialization_fd(const char *ident);
|
||||
|
||||
@@ -128,7 +128,7 @@ TEST(serialize_strv) {
|
||||
|
||||
const char *t = startswith(line, "strv3=");
|
||||
assert_se(t);
|
||||
assert_se(deserialize_strv(&strv2, t) >= 0);
|
||||
assert_se(deserialize_strv(t, &strv2) >= 0);
|
||||
}
|
||||
|
||||
assert_se(strv_equal(strv, strv2));
|
||||
|
||||
Reference in New Issue
Block a user