aboutsummaryrefslogtreecommitdiff
path: root/sysutils/consolekit
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2009-02-02 22:31:54 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2009-02-02 22:31:54 +0000
commitdc2795b91d5a48d10bedc8690ce19b2bcb629f6b (patch)
tree55cd813d6d41c9606b89cf418387d7424757ea51 /sysutils/consolekit
parent58fe8a1226d64657d8d8181b798eecebd8cc67e0 (diff)
downloadports-dc2795b91d5a48d10bedc8690ce19b2bcb629f6b.tar.gz
ports-dc2795b91d5a48d10bedc8690ce19b2bcb629f6b.zip
Replace unnecessary open(2)/close(2) with stat(2) and do not sort result
of glob(3) when counting /dev/ttyv*. Reviewed by: marcus
Notes
Notes: svn path=/head/; revision=227470
Diffstat (limited to 'sysutils/consolekit')
-rw-r--r--sysutils/consolekit/Makefile2
-rw-r--r--sysutils/consolekit/files/patch-src_ck-sysdeps-freebsd.c31
2 files changed, 15 insertions, 18 deletions
diff --git a/sysutils/consolekit/Makefile b/sysutils/consolekit/Makefile
index b8f72ae5353d..030aa9ab5786 100644
--- a/sysutils/consolekit/Makefile
+++ b/sysutils/consolekit/Makefile
@@ -7,7 +7,7 @@
PORTNAME= consolekit
PORTVERSION= 0.3.0
-PORTREVISION= 3
+PORTREVISION= 4
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 5a0e1248b191..ad344ac68f5f 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-06 22:50:57.000000000 -0500
+--- src/ck-sysdeps-freebsd.c.orig 2008-04-03 20:36:21.000000000 -0400
++++ src/ck-sysdeps-freebsd.c 2009-01-30 17:03:00.000000000 -0500
@@ -27,6 +27,7 @@
#include <unistd.h>
#include <string.h>
@@ -24,7 +24,7 @@
*stat = NULL;
}
-@@ -318,38 +317,40 @@ gboolean
+@@ -327,38 +326,38 @@ gboolean
ck_get_max_num_consoles (guint *num)
{
int max_consoles;
@@ -41,19 +41,16 @@
- if (res == 0) {
- goto done;
- }
--
-- while ((t = getttyent ()) != NULL) {
-- if (t->ty_status & TTY_ON && strncmp (t->ty_name, "ttyv", 4) == 0)
+ g.gl_offs = 0;
-+ glob ("/dev/ttyv*", GLOB_DOOFFS, NULL, &g);
++ glob ("/dev/ttyv*", GLOB_DOOFFS | GLOB_NOSORT, NULL, &g);
+ for (i = 0; i < g.gl_pathc && g.gl_pathv[i] != NULL; i++) {
-+ int fd;
++ struct stat sb;
+ char *cdev;
-+
+
+- while ((t = getttyent ()) != NULL) {
+- if (t->ty_status & TTY_ON && strncmp (t->ty_name, "ttyv", 4) == 0)
+ cdev = g.gl_pathv[i];
-+ fd = open (cdev, O_RDONLY | O_NOCTTY);
-+ if (fd > -1) {
-+ close (fd);
++ if (stat (cdev, &sb) > -1 && S_ISCHR (sb.st_mode)) {
max_consoles++;
+ } else {
+ break;
@@ -83,7 +80,7 @@
}
char *
-@@ -360,7 +361,12 @@ ck_get_console_device_for_num (guint num
+@@ -369,7 +368,12 @@ ck_get_console_device_for_num (guint num
/* The device number is always one less than the VT number. */
num--;
@@ -97,7 +94,7 @@
return device;
}
-@@ -370,6 +376,7 @@ ck_get_console_num_from_device (const ch
+@@ -379,6 +383,7 @@ ck_get_console_num_from_device (const ch
guint *num)
{
guint n;
@@ -105,7 +102,7 @@
gboolean ret;
n = 0;
-@@ -379,7 +386,11 @@ ck_get_console_num_from_device (const ch
+@@ -388,7 +393,11 @@ ck_get_console_num_from_device (const ch
return FALSE;
}
@@ -118,7 +115,7 @@
/* The VT number is always one more than the device number. */
n++;
ret = TRUE;
-@@ -399,6 +410,7 @@ ck_get_active_console_num (int consol
+@@ -408,6 +417,7 @@ ck_get_active_console_num (int consol
gboolean ret;
int res;
int active;
@@ -126,7 +123,7 @@
g_assert (console_fd != -1);
-@@ -411,7 +423,12 @@ ck_get_active_console_num (int consol
+@@ -420,7 +430,12 @@ ck_get_active_console_num (int consol
goto out;
}