[mutter] device-pool: Handle interrupted open()



commit a845a07a92ab6d81934b613817bac162c94f910d
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Tue Apr 6 17:08:10 2021 +0200

    device-pool: Handle interrupted open()
    
    Handle open() failing due to being interrupted by trying again until it
    either succeeds, or fails due to some other error. This was an error
    handling path taken when opening sysfs files; do the same here to not
    potentially regress once we open sysfs files with the device pool.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1828>

 src/backends/native/meta-device-pool.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/src/backends/native/meta-device-pool.c b/src/backends/native/meta-device-pool.c
index 69e3e8d2f0..8aa2c194fc 100644
--- a/src/backends/native/meta-device-pool.c
+++ b/src/backends/native/meta-device-pool.c
@@ -247,7 +247,12 @@ meta_device_pool_open (MetaDevicePool       *pool,
     }
   else
     {
-      fd = open (path, O_RDWR | O_CLOEXEC, 0);
+      do
+        {
+          fd = open (path, O_RDWR | O_CLOEXEC);
+        }
+      while (fd == -1 && errno == EINTR);
+
       if (fd == -1)
         {
           g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),


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