diff th_util.c @ 676:f3649df3d9a7

Adjust errno handling.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 25 Feb 2020 07:42:50 +0200
parents 562de49f8b4b
children 4ca6a3b30fe8
line wrap: on
line diff
--- 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;
 }