File openvt.diff of Package vdr

# openvt has a filedescriptor leak. Apply this patch to the kbd package if you
# want to use the vdr initscript over ssh. You only need to recompile openvt,
# not the whole kbd package
--- ./openvt/getfd.c.orig	2003-10-22 00:04:47.000000000 +0200
+++ ./openvt/getfd.c	2003-10-22 00:05:11.000000000 +0200
@@ -3,6 +3,7 @@
 #include <errno.h>
 #include <linux/kd.h>
 #include <sys/ioctl.h>
+#include <unistd.h>
 
 /*
  * getfd.c
@@ -28,8 +29,13 @@
     fd = open(fnam, O_RDONLY);
     if (fd < 0 && errno == EACCES)
       fd = open(fnam, O_WRONLY);
-    if (fd < 0 || ! is_a_console(fd))
+    if (fd < 0 )
       return -1;
+    if (! is_a_console(fd))
+    {
+      close(fd);
+      return -1;
+    }
     return fd;
 }
 
openSUSE Build Service is sponsored by