diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-12-17 23:10:08 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-17 23:10:08 +0900 |
commit | 3267cb45e9458b473413a1322fc03f70da5d3645 (patch) | |
tree | f50b45aa4ab59b1b5b98ecfcda7d675f0493a1d8 /src/nspawn | |
parent | 05de16766b6bae290c500857269b753df2a0c649 (diff) | |
parent | 2d8143048bc67470c76e8975cdecfb6b9823ecce (diff) | |
download | systemd-3267cb45e9458b473413a1322fc03f70da5d3645.tar.gz |
Merge pull request #14208 from poettering/json-homed-prepare
json bits from homed PR
Diffstat (limited to 'src/nspawn')
-rw-r--r-- | src/nspawn/nspawn-oci.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/src/nspawn/nspawn-oci.c b/src/nspawn/nspawn-oci.c index 4519c74b95..782c03c539 100644 --- a/src/nspawn/nspawn-oci.c +++ b/src/nspawn/nspawn-oci.c @@ -172,24 +172,13 @@ static int oci_env(const char *name, JsonVariant *v, JsonDispatchFlags flags, vo static int oci_args(const char *name, JsonVariant *v, JsonDispatchFlags flags, void *userdata) { _cleanup_strv_free_ char **l = NULL; char ***value = userdata; - JsonVariant *e; int r; assert(value); - JSON_VARIANT_ARRAY_FOREACH(e, v) { - const char *n; - - if (!json_variant_is_string(e)) - return json_log(v, flags, SYNTHETIC_ERRNO(EINVAL), - "Argument is not a string."); - - assert_se(n = json_variant_string(e)); - - r = strv_extend(&l, n); - if (r < 0) - return log_oom(); - } + r = json_variant_strv(v, &l); + if (r < 0) + return json_log(v, flags, r, "Cannot parse arguments as list of strings: %m"); if (strv_isempty(l)) return json_log(v, flags, SYNTHETIC_ERRNO(EINVAL), @@ -2214,7 +2203,7 @@ int oci_load(FILE *f, const char *bundle, Settings **ret) { path = strjoina(bundle, "/config.json"); - r = json_parse_file(f, path, &oci, &line, &column); + r = json_parse_file(f, path, 0, &oci, &line, &column); if (r < 0) { if (line != 0 && column != 0) return log_error_errno(r, "Failed to parse '%s' at %u:%u: %m", path, line, column); |