err: Fixup error code range checking in err_to_errno

This also fixes build error in non-debug build because err_strerr is
guarded by LWIP_DEBUG.

Fixes: a1c0a0185b ("bug #48823: posix errors should be removed from arch.h (to new file 'lwip/errno.h'))"
Signed-off-by: Axel Lin <axel.lin@ingics.com>
This commit is contained in:
Axel Lin 2016-10-07 08:30:44 +08:00 committed by Dirk Ziegelmeier
parent ad3530ee10
commit 740182de3c

View File

@ -106,7 +106,7 @@ lwip_strerr(err_t err)
int
err_to_errno(err_t err)
{
if ((err > 0) || (-err >= (err_t)LWIP_ARRAYSIZE(err_strerr))) {
if ((err > 0) || (-err >= (err_t)LWIP_ARRAYSIZE(err_to_errno_table))) {
return EIO;
}
return err_to_errno_table[-err];