[glib: 8/24] gioerror: Map ENOMSG, EBADMSG and ENODATA to G_IO_ERROR_INVALID_DATA




commit 3d6f8430972f2ad5b376e376dd74217ee79a6a98
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Tue Jun 14 19:07:39 2022 +0200

    gioerror: Map ENOMSG, EBADMSG and ENODATA to G_IO_ERROR_INVALID_DATA

 gio/gioerror.c    | 18 ++++++++++++++++++
 gio/tests/error.c |  6 +++---
 2 files changed, 21 insertions(+), 3 deletions(-)
---
diff --git a/gio/gioerror.c b/gio/gioerror.c
index 4045106781..a23664986f 100644
--- a/gio/gioerror.c
+++ b/gio/gioerror.c
@@ -156,6 +156,24 @@ g_io_error_from_errno (gint err_no)
       break;
 #endif
 
+#ifdef ENOMSG
+    case ENOMSG:
+      return G_IO_ERROR_INVALID_DATA;
+      break;
+#endif
+
+#ifdef ENODATA
+    case ENODATA:
+      return G_IO_ERROR_INVALID_DATA;
+      break;
+#endif
+
+#ifdef EBADMSG
+    case EBADMSG:
+      return G_IO_ERROR_INVALID_DATA;
+      break;
+#endif
+
 #ifdef EPERM
     case EPERM:
       return G_IO_ERROR_PERMISSION_DENIED;
diff --git a/gio/tests/error.c b/gio/tests/error.c
index 9cbabc8fd7..2f5189b99a 100644
--- a/gio/tests/error.c
+++ b/gio/tests/error.c
@@ -327,7 +327,7 @@ test_error_from_errno (void)
 
 #ifdef ENOMSG
   g_assert_cmpuint (g_io_error_from_errno (ENOMSG), ==,
-                    G_IO_ERROR_FAILED);
+                    G_IO_ERROR_INVALID_DATA);
 #endif
 
 #ifdef EIDRM
@@ -422,7 +422,7 @@ test_error_from_errno (void)
 
 #ifdef ENODATA
   g_assert_cmpuint (g_io_error_from_errno (ENODATA), ==,
-                    G_IO_ERROR_FAILED);
+                    G_IO_ERROR_INVALID_DATA);
 #endif
 
 #ifdef ETIME
@@ -487,7 +487,7 @@ test_error_from_errno (void)
 
 #ifdef EBADMSG
   g_assert_cmpuint (g_io_error_from_errno (EBADMSG), ==,
-                    G_IO_ERROR_FAILED);
+                    G_IO_ERROR_INVALID_DATA);
 #endif
 
 #ifdef EOVERFLOW


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]