[PATCH:xf86-input-keyboard 18/23] Fix wskbd handling when VT switching.

Thomas Klausner wiz at NetBSD.org
Tue Jul 30 06:08:46 PDT 2013


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
-------------- next part --------------
>From a3b3fa35b27e29321f86dc82e91fa4d3fb30c33f Mon Sep 17 00:00:00 2001
From: Thomas Klausner <wiz at NetBSD.org>
Date: Tue, 30 Jul 2013 15:07:31 +0200
Subject: [PATCH:xf86-input-keyboard 24/24] Check open() return value.

Suggested by Walter Harms <wharms at bfs.de>.

Signed-off-by: Thomas Klausner <wiz at NetBSD.org>
---
 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



More information about the xorg-devel mailing list