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>
This commit is contained in:
Jonas Ådahl 2021-04-06 17:08:10 +02:00
parent 3d882b6410
commit a845a07a92

View File

@ -247,7 +247,12 @@ meta_device_pool_open (MetaDevicePool *pool,
} }
else 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) if (fd == -1)
{ {
g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno), g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),