[PATCH xserver 06/12] dmx: Silence an unused-result warning

Adam Jackson ajax at redhat.com
Fri Jun 16 19:44:46 UTC 2017


Modern glibc is very insistent that you care about whether write()
succeeds:

../hw/dmx/input/usb-keyboard.c: In function ‘kbdUSBCtrl’:
../hw/dmx/input/usb-keyboard.c:292:9: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
         write(priv->fd, &event, sizeof(event));
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 hw/dmx/input/usb-keyboard.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/dmx/input/usb-keyboard.c b/hw/dmx/input/usb-keyboard.c
index e41ad40eb..b26c822c0 100644
--- a/hw/dmx/input/usb-keyboard.c
+++ b/hw/dmx/input/usb-keyboard.c
@@ -289,7 +289,8 @@ kbdUSBCtrl(DevicePtr pDev, KeybdCtrl * ctrl)
             led = i;
         event.code = led;
         event.value = ! !(ctrl->leds & (1 << led));
-        write(priv->fd, &event, sizeof(event));
+        if (write(priv->fd, &event, sizeof(event)) != sizeof(event))
+            DebugF("Failed to set LEDs!\n");
     }
 }
 
-- 
2.13.0



More information about the xorg-devel mailing list