comparison 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
comparison
equal deleted inserted replaced
675:fb4093ad1f7b 676:f3649df3d9a7
181 181
182 /* Error handling 182 /* Error handling
183 */ 183 */
184 int th_get_error() 184 int th_get_error()
185 { 185 {
186 return TH_SYSTEM_ERRORS + errno; 186 return th_errno_to_error(errno);
187 } 187 }
188 188
189 189
190 int th_errno_to_error(int error) 190 int th_errno_to_error(int error)
191 { 191 {
192 return TH_SYSTEM_ERRORS + error; 192 if (error == 0)
193 return THERR_OK;
194 else
195 return TH_SYSTEM_ERRORS + error;
193 } 196 }
194 197
195 198
196 const char *th_error_str(int error) 199 const char *th_error_str(int error)
197 { 200 {