From a845a07a92ab6d81934b613817bac162c94f910d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Tue, 6 Apr 2021 17:08:10 +0200 Subject: [PATCH] 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: --- 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 69e3e8d2f..8aa2c194f 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),