summaryrefslogtreecommitdiff
path: root/package/qingy/patches/patch-src_libraries_vt_c
blob: 84a9842a806093e4c9a55ca498fc2df1104e9e7a (plain)
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
--- qingy-1.0.0.orig/src/libraries/vt.c	2008-11-25 12:21:28.000000000 +0100
+++ qingy-1.0.0/src/libraries/vt.c	2014-01-20 07:53:43.000000000 +0100
@@ -98,14 +98,15 @@ static int getfd()
 int switch_to_tty(int tty)
 {
   char *ttyname = create_tty_name(tty);
+  FILE *_stdin, *_stdout, *_stderr;
   
   if (!ttyname) return 0;
   /* we set stdin, stdout and stderr to the new tty */
-  stdin  = freopen(ttyname, "r", stdin);
-  stdout = freopen(ttyname, "w", stdout);
-  stderr = freopen(ttyname, "w", stderr);
+  _stdin  = freopen(ttyname, "r", stdin);
+  _stdout = freopen(ttyname, "w", stdout);
+  _stderr = freopen(ttyname, "w", stderr);
   free(ttyname);
-  if (!stdin || !stdout || !stderr) return 0;
+  if (!_stdin || !_stdout || !_stderr) return 0;
 
   return 1;
 }
@@ -197,6 +198,7 @@ void stderr_disable(void)
 void stderr_enable(int *vt)
 {
   char *ttyname;
+  FILE *_stderr;
 
 	if (!vt)
 		ttyname = create_tty_name(get_active_tty());
@@ -205,7 +207,7 @@ void stderr_enable(int *vt)
   
   if (!ttyname) return;
 
-	stderr = fopen(ttyname, "w");
+	_stderr = freopen(ttyname, "w", stderr);
   free(ttyname);
 }