do not panic if there is no tty - vx32 - Local 9vx git repository for patches.
Log
Files
Refs
---
commit 77feb8a7e49369856eb1fac75f402e7a2173d4ac
parent 0e345fe6a6994b2df8dd744e9b0e68ce9026a293
Author: Jesus Galan Lopez (yiyus) 
Date:   Wed,  4 Aug 2010 23:41:33 +0200

do not panic if there is no tty

Diffstat:
  src/9vx/tty.c                       |       7 ++++++-

1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/src/9vx/tty.c b/src/9vx/tty.c
@@ -56,7 +56,11 @@ uartreader(void *v)
          * what gets typed ourselves.
          */
         if(tcgetattr(0, &ttprevmode) < 0)
-                panic("could not read tty current mode");
+                /*
+                 * We do not panic here so that
+                 * 9vx can be run without a tty
+                 */
+                goto Read;
         if(tcgetattr(0, &ttmode) >= 0){
                 ttmode.c_lflag &= ~(ECHO|ICANON);
                 if(tcsetattr(0, TCSANOW, &ttmode) >= 0)
@@ -64,6 +68,7 @@ uartreader(void *v)
         }
         signal(SIGINT, bye);
         signal(SIGTERM, bye);
+Read:
         while((n = read(0, buf, sizeof buf)) > 0)
                 echo(buf, n);
 }