gioerror: Map ENOSYS to G_IO_ERROR_NOT_SUPPORTED

If a wrong syscall is used, we can assume that such feature is not
supported at higher level.
This commit is contained in:
Marco Trevisan (Treviño) 2022-06-14 19:35:24 +02:00
parent 587f5f25d0
commit e5841beba6
2 changed files with 7 additions and 1 deletions

View File

@ -230,6 +230,12 @@ g_io_error_from_errno (gint err_no)
break; break;
#endif #endif
#ifdef ENOSYS
case ENOSYS:
return G_IO_ERROR_NOT_SUPPORTED;
break;
#endif
#ifdef ETIMEDOUT #ifdef ETIMEDOUT
case ETIMEDOUT: case ETIMEDOUT:
return G_IO_ERROR_TIMED_OUT; return G_IO_ERROR_TIMED_OUT;

View File

@ -322,7 +322,7 @@ test_error_from_errno (void)
#ifdef ENOSYS #ifdef ENOSYS
g_assert_cmpuint (g_io_error_from_errno (ENOSYS), ==, g_assert_cmpuint (g_io_error_from_errno (ENOSYS), ==,
G_IO_ERROR_FAILED); G_IO_ERROR_NOT_SUPPORTED);
#endif #endif
#ifdef ENOMSG #ifdef ENOMSG