diff options
author | Alice Frosi <afrosi@redhat.com> | 2023-06-14 14:07:19 +0200 |
---|---|---|
committer | Alice Frosi <afrosi@redhat.com> | 2023-06-14 14:07:19 +0200 |
commit | 008c65c30900608d7e4a46e927d5ea3d22fd6255 (patch) | |
tree | f20d53950af522b8ce6af9829c82a968e5b15218 | |
parent | 7e85c2d749afe3ba47ae0aa2302ffac9d6861a44 (diff) | |
parent | 7954fe5d9627defcb5f73194c60d992df4137c10 (diff) | |
download | seitan-008c65c30900608d7e4a46e927d5ea3d22fd6255.tar seitan-008c65c30900608d7e4a46e927d5ea3d22fd6255.tar.gz seitan-008c65c30900608d7e4a46e927d5ea3d22fd6255.tar.bz2 seitan-008c65c30900608d7e4a46e927d5ea3d22fd6255.tar.lz seitan-008c65c30900608d7e4a46e927d5ea3d22fd6255.tar.xz seitan-008c65c30900608d7e4a46e927d5ea3d22fd6255.tar.zst seitan-008c65c30900608d7e4a46e927d5ea3d22fd6255.zip |
Merge branch 'devel'
-rw-r--r-- | cooker/emit.c | 2 | ||||
-rw-r--r-- | cooker/parse.c | 10 | ||||
-rw-r--r-- | demo/connect.hjson | 10 | ||||
-rw-r--r-- | demo/mknod.hjson | 2 |
4 files changed, 14 insertions, 10 deletions
diff --git a/cooker/emit.c b/cooker/emit.c index 1a7f3a9..8dc3e82 100644 --- a/cooker/emit.c +++ b/cooker/emit.c @@ -356,8 +356,6 @@ void emit_return(struct gluten_ctx *g, struct gluten_offset v, ret->desc = o; debug(" %i: OP_RETURN:", g->ip.offset); - debug(" \t val=(%s %d) errno=%d cont=%s", gluten_offset_name[v.type], - v.offset, error, cont ? "true" : "false"); if (++g->ip.offset > INST_MAX) die("Too many instructions"); diff --git a/cooker/parse.c b/cooker/parse.c index 46ca123..36c2649 100644 --- a/cooker/parse.c +++ b/cooker/parse.c @@ -98,7 +98,7 @@ static void handle_return(struct gluten_ctx *g, JSON_Value *value) struct gluten_offset data = NULL_OFFSET, error = NULL_OFFSET; JSON_Object *obj = json_value_get_object(value); union value vv = NO_VALUE, ve = NO_VALUE; - const char *tag_error, *tag_value; + const char *tag_error = NULL, *tag_value = NULL; JSON_Value *jvalue; bool cont = false; char buf[BUFSIZ]; @@ -108,8 +108,8 @@ static void handle_return(struct gluten_ctx *g, JSON_Value *value) jvalue = json_object_get_value(obj, "error"); if (json_value_get_type(jvalue) == JSONNumber) { - ve.v_u32 = json_value_get_number(jvalue); - error = emit_data(g, U32, sizeof(ve.v_u32), &ve); + ve.v_int = json_value_get_number(jvalue); + error = emit_data(g, INT, sizeof(ve.v_int), &ve); } else if ((tag_error = json_object_get_string(obj, "error"))) { error = gluten_get_tag(g, tag_error); } @@ -134,13 +134,13 @@ static void handle_return(struct gluten_ctx *g, JSON_Value *value) if (tag_value) n += snprintf(buf + n, BUFSIZ - n, "tag %s", tag_value); else - n += snprintf(buf + n, BUFSIZ - n, "%lu", vv.v_u64); + n += snprintf(buf + n, BUFSIZ - n, "%ld", vv.v_u64); n = snprintf(buf, BUFSIZ, " , error "); if (tag_error) n += snprintf(buf + n, BUFSIZ - n, "tag %s", tag_error); else - n += snprintf(buf + n, BUFSIZ - n, "%u", ve.v_u32); + n += snprintf(buf + n, BUFSIZ - n, "%d", ve.v_int); } else { snprintf(buf, BUFSIZ, " emit return: continue"); } diff --git a/demo/connect.hjson b/demo/connect.hjson index 3bf0747..de4c119 100644 --- a/demo/connect.hjson +++ b/demo/connect.hjson @@ -1,7 +1,7 @@ [ - { /* connect to another path (/var/run/pr-helper.sock -> /tmp/demo.sock) */ + { /* connect to another path (/cool.sock -> /tmp/demo.sock) */ "match": [ - { "connect": { "addr": { "family": "unix", "path": "/var/run/pr-helper.sock" }, "fd": { "tag": "fd" } } } + { "connect": { "addr": { "family": "unix", "path": "/cool.sock" }, "fd": { "tag": "fd" } } } ], "call": [ { "socket": { "family": "unix", "type": "stream", "flags": 0, "protocol": 0 }, "ret": "new_fd" }, @@ -21,5 +21,11 @@ { "connect": { "addr": { "family": "unix", "path": "/error.sock" } } } ], "return": { "value": 0, "error": -1 } + }, + { /* Continue all the other connect syscall */ + "match": [ + { "connect": {} } + ], + "return": { "continue": true } } ] diff --git a/demo/mknod.hjson b/demo/mknod.hjson index 7055aee..40b5b8b 100644 --- a/demo/mknod.hjson +++ b/demo/mknod.hjson @@ -28,6 +28,6 @@ }, "context": { "mnt": "caller" } }, - "return": { "value": 0 } + "return": { "value": 0, "error": 0 } } ] |