gioerror: Map ENETDOWN to G_IO_ERROR_NETWORK_UNREACHABLE

This commit is contained in:
Marco Trevisan (Treviño) 2022-06-14 19:14:35 +02:00
parent 3d6f843097
commit 587f5f25d0
2 changed files with 7 additions and 1 deletions

View File

@ -291,6 +291,12 @@ g_io_error_from_errno (gint err_no)
break; break;
#endif #endif
#ifdef ENETDOWN
case ENETDOWN:
return G_IO_ERROR_NETWORK_UNREACHABLE;
break;
#endif
#ifdef ECONNREFUSED #ifdef ECONNREFUSED
case ECONNREFUSED: case ECONNREFUSED:
return G_IO_ERROR_CONNECTION_REFUSED; return G_IO_ERROR_CONNECTION_REFUSED;

View File

@ -577,7 +577,7 @@ test_error_from_errno (void)
#ifdef ENETDOWN #ifdef ENETDOWN
g_assert_cmpuint (g_io_error_from_errno (ENETDOWN), ==, g_assert_cmpuint (g_io_error_from_errno (ENETDOWN), ==,
G_IO_ERROR_FAILED); G_IO_ERROR_NETWORK_UNREACHABLE);
#endif #endif
#ifdef ECONNABORTED #ifdef ECONNABORTED