mirror of
https://github.com/brl/mutter.git
synced 2024-11-28 02:50:41 -05:00
backends: Set error when opening /sys file fails
The caller in clutter really expects an error if fd==-1, so make sure we set one here. Otherwise we get a nice crash in addition to the failure to open the /sys file. Also, retry on EINTR. https://bugzilla.gnome.org/show_bug.cgi?id=784881
This commit is contained in:
parent
9f68507f0c
commit
0159efe34b
@ -187,9 +187,22 @@ on_evdev_device_open (const char *path,
|
|||||||
|
|
||||||
/* Allow readonly access to sysfs */
|
/* Allow readonly access to sysfs */
|
||||||
if (g_str_has_prefix (path, "/sys/"))
|
if (g_str_has_prefix (path, "/sys/"))
|
||||||
|
{
|
||||||
|
do
|
||||||
{
|
{
|
||||||
fd = open (path, flags);
|
fd = open (path, flags);
|
||||||
if (fd >= 0)
|
}
|
||||||
|
while (fd < 0 && errno == EINTR);
|
||||||
|
|
||||||
|
if (fd < 0)
|
||||||
|
{
|
||||||
|
g_set_error (error,
|
||||||
|
G_FILE_ERROR,
|
||||||
|
g_file_error_from_errno (errno),
|
||||||
|
"Could not open /sys file: %s: %m", path);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
g_hash_table_add (self->sysfs_fds, GINT_TO_POINTER (fd));
|
g_hash_table_add (self->sysfs_fds, GINT_TO_POINTER (fd));
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user