summaryrefslogtreecommitdiffstats
path: root/sysutils/consolekit
diff options
context:
space:
mode:
authormarcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059>2008-02-05 09:59:22 +0800
committermarcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059>2008-02-05 09:59:22 +0800
commit9808e2041e336ba866df78bf6c1579812cb508fb (patch)
treec13c3dc0559803ad7695bc5cd6a6ae8f3838fefb /sysutils/consolekit
parente207fe4cb56632d7d2027d3e53953147af39bd4a (diff)
downloadmarcuscom-ports-9808e2041e336ba866df78bf6c1579812cb508fb.tar
marcuscom-ports-9808e2041e336ba866df78bf6c1579812cb508fb.tar.gz
marcuscom-ports-9808e2041e336ba866df78bf6c1579812cb508fb.tar.bz2
marcuscom-ports-9808e2041e336ba866df78bf6c1579812cb508fb.tar.lz
marcuscom-ports-9808e2041e336ba866df78bf6c1579812cb508fb.tar.xz
marcuscom-ports-9808e2041e336ba866df78bf6c1579812cb508fb.tar.zst
marcuscom-ports-9808e2041e336ba866df78bf6c1579812cb508fb.zip
Fix a bug regarding console names (they are numbered in hex, not decimal).
Also, use MAXCONS instead of reading /etc/ttys, since consoles may become active later. git-svn-id: svn://creme-brulee.marcuscom.com/ports/trunk@10344 df743ca5-7f9a-e211-a948-0013205c9059
Diffstat (limited to 'sysutils/consolekit')
-rw-r--r--sysutils/consolekit/Makefile2
-rw-r--r--sysutils/consolekit/files/patch-src_ck-sysdeps-freebsd.c106
2 files changed, 77 insertions, 31 deletions
diff --git a/sysutils/consolekit/Makefile b/sysutils/consolekit/Makefile
index 8d879e954..bf59f80dd 100644
--- a/sysutils/consolekit/Makefile
+++ b/sysutils/consolekit/Makefile
@@ -7,7 +7,7 @@
PORTNAME= consolekit
PORTVERSION= 0.2.7
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= sysutils gnome
MASTER_SITES= http://people.freedesktop.org/~mccann/dist/
DISTFILES= ConsoleKit-${PORTVERSION}${EXTRACT_SUFX}
diff --git a/sysutils/consolekit/files/patch-src_ck-sysdeps-freebsd.c b/sysutils/consolekit/files/patch-src_ck-sysdeps-freebsd.c
index 8311c9dbf..35e000cc5 100644
--- a/sysutils/consolekit/files/patch-src_ck-sysdeps-freebsd.c
+++ b/sysutils/consolekit/files/patch-src_ck-sysdeps-freebsd.c
@@ -1,5 +1,5 @@
--- src/ck-sysdeps-freebsd.c.orig 2008-01-23 09:30:44.000000000 -0500
-+++ src/ck-sysdeps-freebsd.c 2008-02-04 19:32:33.000000000 -0500
++++ src/ck-sysdeps-freebsd.c 2008-02-04 20:56:57.000000000 -0500
@@ -43,6 +43,10 @@
( (M&0xfff) << 8) | ( (m&0xfff00) << 12) | (m&0xff) \
)
@@ -27,46 +27,92 @@
*stat = NULL;
}
-@@ -319,8 +321,10 @@ ck_get_max_num_consoles (guint *num)
+@@ -318,38 +320,36 @@ gboolean
+ ck_get_max_num_consoles (guint *num)
{
int max_consoles;
- int res;
-+ int fd;
- gboolean ret;
- struct ttyent *t;
-+ char *cdev;
+- int res;
+- gboolean ret;
+- struct ttyent *t;
++ int i;
- ret = FALSE;
- max_consoles = 0;
-@@ -331,9 +335,28 @@ ck_get_max_num_consoles (guint *num)
- }
+- ret = FALSE;
+- max_consoles = 0;
+-
+- res = setttyent ();
+- if (res == 0) {
+- goto done;
+- }
++ max_consoles = 0;
- while ((t = getttyent ()) != NULL) {
+- while ((t = getttyent ()) != NULL) {
- if (t->ty_status & TTY_ON && strncmp (t->ty_name, "ttyv", 4) == 0)
- max_consoles++;
- }
-+ if (t->ty_status & TTY_ON && strncmp (t->ty_name, "ttyv", 4) == 0) {
-+ cdev = g_strdup_printf ("/dev/%s", t->ty_name);
-+
-+ fd = open (cdev, O_RDONLY | O_NOCTTY);
-+ if (fd > -1) {
-+ close (fd);
-+ max_consoles++;
-+ }
-+ g_free (cdev);
-+ }
-+ }
++ for (i = 0; i < MAXCONS; i++) {
++ int fd;
++ char *cdev;
+
-+ if (max_consoles < MAXCONS) {
-+ /* We do this once more to have a console for X sessions. */
-+ cdev = g_strdup_printf ("/dev/ttyv%i", max_consoles);
++ cdev = g_strdup_printf ("/dev/ttyv%x", i);
+ fd = open (cdev, O_RDONLY | O_NOCTTY);
++ g_free (cdev);
+ if (fd > -1) {
-+ max_consoles++;
+ close (fd);
++ max_consoles++;
++ } else {
++ break;
+ }
-+ g_free (cdev);
+ }
++
++ /*
++ * Increment one more so that all consoles are properly counted
++ * this is arguable a bug in vt_add_watches().
++ */
++ max_consoles++;
+
+- /* Increment one more so that all consoles are properly counted
+- * this is arguable a bug in vt_add_watches().
+- */
+- max_consoles++;
+-
+- ret = TRUE;
+-
+- endttyent ();
+-
+-done:
+ if (num != NULL) {
+ *num = max_consoles;
+ }
+
+- return ret;
++ return TRUE;
+ }
+
+ char *
+@@ -360,7 +360,7 @@ ck_get_console_device_for_num (guint num
+ /* The device number is always one less than the VT number. */
+ num--;
+
+- device = g_strdup_printf ("/dev/ttyv%u", num);
++ device = g_strdup_printf ("/dev/ttyv%x", num);
+
+ return device;
+ }
+@@ -379,7 +379,7 @@ ck_get_console_num_from_device (const ch
+ return FALSE;
+ }
+
+- if (sscanf (device, "/dev/ttyv%u", &n) == 1) {
++ if (sscanf (device, "/dev/ttyv%x", &n) == 1) {
+ /* The VT number is always one more than the device number. */
+ n++;
+ ret = TRUE;
+@@ -411,7 +411,7 @@ ck_get_active_console_num (int consol
+ goto out;
+ }
+
+- g_debug ("Active VT is: %d (ttyv%d)", active, active - 1);
++ g_debug ("Active VT is: %d (ttyv%x)", active, active - 1);
+ ret = TRUE;
- /* Increment one more so that all consoles are properly counted
- * this is arguable a bug in vt_add_watches().
+ out: