1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
From 92dc27dd57c83e9e2c798bda41ec111d26e1e3e2 Mon Sep 17 00:00:00 2001
From: Roman Kyrylych <roman@archlinux.org>
Date: Sat, 15 Mar 2008 18:57:04 +0200
Subject: [PATCH] Do not use isatty() when built with klibc
Signed-off-by: Roman Kyrylych <roman@archlinux.org>
---
src/getfd.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/getfd.c b/src/getfd.c
index 7f6d70e..3cef522 100644
--- a/src/getfd.c
+++ b/src/getfd.c
@@ -16,6 +16,7 @@
* if someone else used X (which does a chown on /dev/console).
*/
+#ifndef __klibc__
static int
is_a_console(int fd) {
char arg;
@@ -25,6 +26,7 @@ is_a_console(int fd) {
&& ioctl(fd, KDGKBTYPE, &arg) == 0
&& ((arg == KB_101) || (arg == KB_84)));
}
+#endif
static int
open_a_console(const char *fnam) {
@@ -41,10 +43,12 @@ open_a_console(const char *fnam) {
fd = open(fnam, O_RDONLY);
if (fd < 0)
return -1;
+ #ifndef __klibc__
if (!is_a_console(fd)) {
close(fd);
return -1;
}
+ #endif
return fd;
}
@@ -80,9 +84,11 @@ int getfd(const char *fnam) {
if (fd >= 0)
return fd;
+ #ifndef __klibc__
for (fd = 0; fd < 3; fd++)
if (is_a_console(fd))
return fd;
+ #endif
fprintf(stderr,
_("Couldnt get a file descriptor referring to the console\n"));
--
1.5.3.7
|