[vdr] VDR corrupts terminal, if started in background

Manuel Reimer Manuel.Reimer at gmx.de
Thu Jul 23 15:55:50 CEST 2009


Hello,

while installing my VDR, I noticed, that I always get a "staircase effect" on the terminal, supplied via "-t" switch, as soon as VDR is killed for the first time.

I'm using "runvdr-extreme":
http://www.udo-richter.de/vdr/scripts.html

In runvdr-extreme, the VDR itself is started in background. This, in detail, causes the following (All line numbers for VDR 1.7.8):

- As a background process doesn't have a STDIN, the line, which should store the terminal settings to "savedTm" (Line 171 in vdr.c), just does nothing, but sets "HasStdin" to "false".
- If a terminal device is supplied using "-t" switch, then STDIN, STDOUT and STDERR are connected to it (Line 506 in vdr.c) and "HasStdin" is set to "true".
- Before exit, VDR checks the state of the variable "HasStdin" and resets the terminal status to "savedTm" (Line 1314 in vdr.c), saved on start (which is undefined, now!)

Suggested fix could be something like this (untested!):

--- vdr.c.org   2009-07-23 15:50:42.217445637 +0200
+++ vdr.c       2009-07-23 15:50:44.545594171 +0200
@@ -503,12 +503,13 @@ int main(int argc, char *argv[])
      }
   else if (Terminal) {
      // Claim new controlling terminal
      stdin  = freopen(Terminal, "r", stdin);
      stdout = freopen(Terminal, "w", stdout);
      stderr = freopen(Terminal, "w", stderr);
+     tcgetattr(STDIN_FILENO, &savedTm);
      HasStdin = true;
      }

A working workaround seems to be to execute VDR in the following way:

vdr -t "$TERMINAL" < "$TERMINAL" &

CU

Manuel Reimer
-- 
()  ascii ribbon campaign - against html mail
/\                        - gegen HTML-Mail
answers as html mail will be deleted automatically!
Antworten als HTML-Mail werden automatisch gelöscht!

Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser



More information about the vdr mailing list