# HG changeset patch # User Matti Hamalainen # Date 1582609370 -7200 # Node ID f3649df3d9a7ca45b72b5e0761fb93cd644275b9 # Parent fb4093ad1f7bdb6edf9ec542efe81cb5cfbc4965 Adjust errno handling. diff -r fb4093ad1f7b -r f3649df3d9a7 th_util.c --- a/th_util.c Tue Feb 25 06:15:08 2020 +0200 +++ b/th_util.c Tue Feb 25 07:42:50 2020 +0200 @@ -183,13 +183,16 @@ */ int th_get_error() { - return TH_SYSTEM_ERRORS + errno; + return th_errno_to_error(errno); } int th_errno_to_error(int error) { - return TH_SYSTEM_ERRORS + error; + if (error == 0) + return THERR_OK; + else + return TH_SYSTEM_ERRORS + error; }