From 902eeb37be9628b2b96b8bd1c79602b912c47ca4 Mon Sep 17 00:00:00 2001 From: Oldes Date: Fri, 21 Jan 2022 14:38:13 +0100 Subject: [PATCH] CHANGE: report port error reasons as positive integers --- src/core/c-error.c | 2 +- src/core/n-io.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/c-error.c b/src/core/c-error.c index 0d9d0d7dfb..1b1873b142 100644 --- a/src/core/c-error.c +++ b/src/core/c-error.c @@ -633,7 +633,7 @@ static REBOL_STATE Top_State; // Boot var: holds error state during boot val = Get_Object(spec, STD_PORT_SPEC_HEAD_REF); // most informative if (IS_NONE(val)) val = Get_Object(spec, STD_PORT_SPEC_HEAD_TITLE); - DS_PUSH_INTEGER(err_code); + DS_PUSH_INTEGER(-err_code); Trap2(errnum, val, DS_TOP); } diff --git a/src/core/n-io.c b/src/core/n-io.c index 961c205f3d..bba40062fe 100644 --- a/src/core/n-io.c +++ b/src/core/n-io.c @@ -592,7 +592,7 @@ static REBSER *Read_All_File(char *fname) REBVAL *arg = D_ARG(1); REBSER *ser; REBINT n; - REBVAL val, reason; + REBVAL val; ser = Value_To_OS_Path(arg, TRUE); // it should be safe not to check result from Value_To_OS_Path (it always succeeds) @@ -609,8 +609,8 @@ static REBSER *Read_All_File(char *fname) SET_FILE(arg, ser); if (NZ(n)) { - SET_INTEGER(&reason, n); - Trap2(RE_CANNOT_OPEN, arg, &reason); + SET_INTEGER(D_RET, -n); + Trap2(RE_CANNOT_OPEN, arg, D_RET); } return R_ARG1; }