[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Final patch



On Sun, Jul 04, 2004 at 12:13:10PM +0300, Recai Oktas wrote:
> Hi,
> 
> After getting success reports from Christian (French keyboard) and 
> Eugeniy (Ukrainian keyboard), I prepared a single patch which applies 
> cleanly to the current kbd-chooser.  (This patch includes some minor 
> code cleanups.  I've re-tested it here with the French, Ukrainian and 
> Turkish keymaps.  Everything seems fine. [1])  Here is the changelog:
> 
>     * Denis Barbier
>       - Make kbd-chooser work with keymaps containing unicode chars.
>     * Recai Oktas
>       - Set console mode to unicode.  Closes: #251550.
>       - Prevent too many file descriptors referring to the console.
> 
> Could you apply the patch?

In fact there is no need for kbd-mode, kbd-chooser (or any other program
run early) should call ioctl to set keyboard in Unicode mode.
I did not notice that getfd() opens a new file descriptor each time it
is called, but this can be solved without changing current prototypes,
e.g. this (untested) patch should do the trick.

Denis
Index: packages/kbd-chooser/getfd.c
===================================================================
--- packages/kbd-chooser/getfd.c	(revision 17443)
+++ packages/kbd-chooser/getfd.c	(working copy)
@@ -45,7 +45,9 @@
 }
 
 int getfd() {
-    int fd;
+    static int fd = -1;
+    if (fd >= 0)
+      return fd;
 
     fd = open_a_console("/dev/tty");
     if (fd >= 0)

Reply to: