patch-src_libraries_vt_c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. --- qingy-1.0.0.orig/src/libraries/vt.c 2008-11-25 12:21:28.000000000 +0100
  2. +++ qingy-1.0.0/src/libraries/vt.c 2014-01-20 07:53:43.000000000 +0100
  3. @@ -98,14 +98,15 @@ static int getfd()
  4. int switch_to_tty(int tty)
  5. {
  6. char *ttyname = create_tty_name(tty);
  7. + FILE *_stdin, *_stdout, *_stderr;
  8. if (!ttyname) return 0;
  9. /* we set stdin, stdout and stderr to the new tty */
  10. - stdin = freopen(ttyname, "r", stdin);
  11. - stdout = freopen(ttyname, "w", stdout);
  12. - stderr = freopen(ttyname, "w", stderr);
  13. + _stdin = freopen(ttyname, "r", stdin);
  14. + _stdout = freopen(ttyname, "w", stdout);
  15. + _stderr = freopen(ttyname, "w", stderr);
  16. free(ttyname);
  17. - if (!stdin || !stdout || !stderr) return 0;
  18. + if (!_stdin || !_stdout || !_stderr) return 0;
  19. return 1;
  20. }
  21. @@ -197,6 +198,7 @@ void stderr_disable(void)
  22. void stderr_enable(int *vt)
  23. {
  24. char *ttyname;
  25. + FILE *_stderr;
  26. if (!vt)
  27. ttyname = create_tty_name(get_active_tty());
  28. @@ -205,7 +207,7 @@ void stderr_enable(int *vt)
  29. if (!ttyname) return;
  30. - stderr = fopen(ttyname, "w");
  31. + _stderr = freopen(ttyname, "w", stderr);
  32. free(ttyname);
  33. }