[kservice] use C89 format to avoid warning

This commit is contained in:
Meco Man 2023-10-22 11:54:54 -04:00
parent 1d0924c12a
commit 1e2bb8ea7a
1 changed files with 3 additions and 1 deletions

View File

@ -142,10 +142,12 @@ static struct _errno_str_t rt_errno_strs[] =
*/
const char *rt_strerror(rt_err_t error)
{
int i = 0;
if (error < 0)
error = -error;
for (int i = 0; i < sizeof(rt_errno_strs) / sizeof(rt_errno_strs[0]); i++)
for (i = 0; i < sizeof(rt_errno_strs) / sizeof(rt_errno_strs[0]); i++)
{
if (rt_errno_strs[i].error == error)
return rt_errno_strs[i].str;