From d3917582873df723aa2a3ddbb6116950292e114c Mon Sep 17 00:00:00 2001 From: Alice Frosi Date: Tue, 29 Aug 2023 11:50:00 +0200 Subject: cooker: simplify tag and add caller metadata Group the metadata information: - simplify the json by removing the 'tag' and only using 'get' and 'set' keys - get uid and gid at runtime for the target ('caller'). This can be useful when the the UID and GID of the target are only known at runtime and they need to be used for setting the permissions of files - updated example demo/mknod.hjson Signed-off-by: Alice Frosi --- cooker/match.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'cooker/match.c') diff --git a/cooker/match.c b/cooker/match.c index eeedead..36ac9df 100644 --- a/cooker/match.c +++ b/cooker/match.c @@ -119,7 +119,7 @@ xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx if (json_value_get_type(jvalue) == JSONObject && (tmp = json_value_get_object(jvalue)) && - (tag_name = json_object_get_string(tmp, "tag"))) { + (tag_name = json_object_get_string(tmp, "set"))) { debug(" setting tag reference '%s'", tag_name); gluten_add_tag(g, tag_name, offset); @@ -258,7 +258,9 @@ xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx parse_field(g, offset, cmp, jump, index, f, jvalue); break; case STRING: - v.v_str = json_value_get_string(jvalue); + if ((v.v_str = json_value_get_string(jvalue)) == NULL) + die(" failed parsing field for value:%s", + json_serialize_to_string_pretty(jvalue)); if (strlen(v.v_str) + 1 > f->size) die(" string %s too long for field", v.v_str); -- cgit v1.2.3