aboutgitcodelistschat:MatrixIRC
diff options
context:
space:
mode:
authorAlice Frosi <afrosi@redhat.com>2023-09-01 11:44:12 +0200
committerAlice Frosi <afrosi@redhat.com>2023-09-01 11:44:12 +0200
commit13c82bafa232e476e96d225e6fdcb5bee0f394f0 (patch)
tree2c9d86843662382f925538d05980a3792cd72fc9
parent59f7f7c241253293c25e001c9340f1deeb138311 (diff)
downloadseitan-13c82bafa232e476e96d225e6fdcb5bee0f394f0.tar
seitan-13c82bafa232e476e96d225e6fdcb5bee0f394f0.tar.gz
seitan-13c82bafa232e476e96d225e6fdcb5bee0f394f0.tar.bz2
seitan-13c82bafa232e476e96d225e6fdcb5bee0f394f0.tar.lz
seitan-13c82bafa232e476e96d225e6fdcb5bee0f394f0.tar.xz
seitan-13c82bafa232e476e96d225e6fdcb5bee0f394f0.tar.zst
seitan-13c82bafa232e476e96d225e6fdcb5bee0f394f0.zip
cooker: fix wrong check
-rw-r--r--cooker/call.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/cooker/call.c b/cooker/call.c
index a09194a..9a94d58 100644
--- a/cooker/call.c
+++ b/cooker/call.c
@@ -20,9 +20,9 @@ static bool is_metadata_obj(JSON_Object *metadata)
{
if (!metadata)
return false;
- return ((!json_object_get_string(metadata, "caller")) ||
- (!json_object_get_string(metadata, "set")) ||
- (!json_object_get_string(metadata, "get")));
+ return ((json_object_get_string(metadata, "caller")) ||
+ (json_object_get_string(metadata, "set")) ||
+ (json_object_get_string(metadata, "get")));
}
/* TODO: refactor and simplify this horrible function */
@@ -83,7 +83,9 @@ static union value parse_metadata(struct gluten_ctx *g, struct field *f,
}
if (json_object_get_count(metadata) > count)
- die("stray object in tag reference");
+ die("stray object in tag reference: %s",
+ json_serialize_to_string(
+ json_object_get_wrapping_value(metadata)));
if (!count)
die("invalid tag specification");
@@ -162,7 +164,8 @@ static union value parse_field(struct gluten_ctx *g, struct arg *args,
if (offset.type != OFFSET_NULL)
offset.offset += f->offset;
- if (!(tmp1 = json_value_get_object(jvalue)) && is_metadata_obj(tmp1))
+ if (json_value_get_type(jvalue) == JSONObject &&
+ (tmp1 = json_value_get_object(jvalue)) && is_metadata_obj(tmp1))
v = parse_metadata(g, f, &base_offset, offset, tmp1, dry_run,
add);
if (v.v_num == 0)