On Tue, Jul 30, 2013 at 12:27:03PM +0200, walter harms wrote:
> You should check the return for open to avoid
> confusing errormessages from the following ioctl.

Ok, attached.

> You can make the following ioctl a set_version() function as it
> can be merged with patch 12

That is already a function, see patch 22 or 23.
 Thomas
>From a3b3fa35b27e29321f86dc82e91fa4d3fb30c33f Mon Sep 17 00:00:00 2001
From: Thomas Klausner <[email protected]>
Date: Tue, 30 Jul 2013 15:07:31 +0200
Subject: [PATCH:xf86-input-keyboard 24/24] Check open() return value.

Suggested by Walter Harms <[email protected]>.

Signed-off-by: Thomas Klausner <[email protected]>
---
 src/bsd_kbd.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/bsd_kbd.c b/src/bsd_kbd.c
index 175c544..2eb7885 100644
--- a/src/bsd_kbd.c
+++ b/src/bsd_kbd.c
@@ -226,6 +226,10 @@ KbdOn(InputInfoPtr pInfo, int what)
                 if ((pKbd->wsKbdDev[0] != 0) && (pInfo->fd == -1)) {
                        xf86Msg(X_INFO, "opening %s\n", pKbd->wsKbdDev);
                        pInfo->fd = open(pKbd->wsKbdDev, O_RDONLY | O_NONBLOCK 
| O_EXCL);
+                       if (pInfo->fd == -1) {
+                               xf86Msg(X_ERROR, "cannot open \"%s\"\n", 
pKbd->wsKbdDev);
+                               return FALSE;
+                       }
                        if (WSSetVersion(pInfo->fd, pInfo->name) == FALSE)
                                return FALSE;
                }
-- 
1.8.3.3

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to