Check result from fstat
From xf86-video-intel commit:
2dc93b2a6c832ce8b972de90d09080e860dcd40f
Based on commit from:
https://chromium.googlesource.com/chromiumos%2Fthird_party%2Fxf86-video-armsoc
badfada06d7998c9134aeaa48eba41c1b1b55427
by djkurtz@chromium.org
Change-Id: Id03c424707172a92a1c8eb9bc8246c61443e5761
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 9748412..1bc0be2 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1462,8 +1462,9 @@
/*
* Hot Plug Event handling:
+ * TODO: MIDEGL-1441: Do we need to keep this handler, which
+ * Rob originally wrote?
*/
-
static void
drmmode_handle_uevents(int fd, void *closure)
{
@@ -1479,17 +1480,17 @@
if (!dev)
return;
- /* TODO: MIDEGL-1441: Do we need to keep this code, which
- * Rob originally wrote? (i.e. up thru the "if" statement)?
- */
-
/*
* Check to make sure this event is directed at our
* device (by comparing dev_t values), then make
* sure it's a hotplug event (HOTPLUG=1)
*/
udev_devnum = udev_device_get_devnum(dev);
- fstat(pARMSOC->drmFD, &s);
+ if (fstat(pARMSOC->drmFD, &s)) {
+ ERROR_MSG("fstat failed: %s", strerror(errno));
+ udev_device_unref(dev);
+ return;
+ }
hotplug = udev_device_get_property_value(dev, "HOTPLUG");