From bf56984482d83d1a178f4da6483fbd350457e438 Mon Sep 17 00:00:00 2001 From: Timerix Date: Sun, 10 Aug 2025 21:33:16 +0300 Subject: [PATCH] try_stderrcode --- include/tlibc/errors.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/tlibc/errors.h b/include/tlibc/errors.h index 335ccab..c736bb7 100755 --- a/include/tlibc/errors.h +++ b/include/tlibc/errors.h @@ -85,3 +85,10 @@ typedef struct Result_ { Error_printAndExit(_rname(N).error);\ };\ } while(0) + +#define try_stderrcode(CALL) do {\ + int r = CALL;\ + if(r != 0){\ + Return RESULT_ERROR(strerror(r), false);\ + }\ +} while(0)