[glib: 7/24] gioerror: Map ENFILE to G_IO_ERROR_TOO_MANY_OPEN_FILES




commit 19417b1a676b320247b32deada6a529eeea999cd
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Tue Jun 14 18:42:48 2022 +0200

    gioerror: Map ENFILE to G_IO_ERROR_TOO_MANY_OPEN_FILES
    
    ENFILE stands for "Too many open files in system", so we can definitely
    group it together with EMFILE ("Too many open files").

 gio/gioerror.c    | 6 ++++++
 gio/tests/error.c | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/gio/gioerror.c b/gio/gioerror.c
index 80ce71f90b..4045106781 100644
--- a/gio/gioerror.c
+++ b/gio/gioerror.c
@@ -249,6 +249,12 @@ g_io_error_from_errno (gint err_no)
       break;
 #endif
 
+#ifdef ENFILE
+    case ENFILE:
+      return G_IO_ERROR_TOO_MANY_OPEN_FILES;
+      break;
+#endif
+
 #ifdef EADDRINUSE
     case EADDRINUSE:
       return G_IO_ERROR_ADDRESS_IN_USE;
diff --git a/gio/tests/error.c b/gio/tests/error.c
index 8cb9e71976..9cbabc8fd7 100644
--- a/gio/tests/error.c
+++ b/gio/tests/error.c
@@ -277,7 +277,7 @@ test_error_from_errno (void)
 
 #ifdef ENFILE
   g_assert_cmpint (g_io_error_from_errno (ENFILE), ==,
-                   G_IO_ERROR_FAILED);
+                   G_IO_ERROR_TOO_MANY_OPEN_FILES);
 #endif
 
 #ifdef ENOTTY


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