Jerry James 9f2631
--- ./src/system.c.orig	2014-12-09 20:00:00.000000000 -0700
Jerry James 9f2631
+++ ./src/system.c	2015-01-14 20:00:00.000000000 -0700
Jerry James 9f2631
@@ -1831,8 +1831,8 @@ void InitSystem (
Jerry James 9f2631
 #if HAVE_TTYNAME
Jerry James 9f2631
     syBuf[0].fp = fileno(stdin);
Jerry James 9f2631
     syBuf[0].bufno = -1;
Jerry James 9f2631
-    if ( isatty( fileno(stdin) ) ) {
Jerry James 9f2631
-        if ( isatty( fileno(stdout) )
Jerry James 9f2631
+    if ( isatty( fileno(stdin) ) && ttyname(fileno(stdin)) != NULL ) {
Jerry James 9f2631
+        if ( isatty( fileno(stdout) ) && ttyname(fileno(stdout)) != NULL
Jerry James 9f2631
           && ! strcmp( ttyname(fileno(stdin)), ttyname(fileno(stdout)) ) )
Jerry James 9f2631
             syBuf[0].echo = fileno(stdout);
Jerry James 9f2631
         else
Jerry James 9f2631
@@ -1845,8 +1845,8 @@ void InitSystem (
Jerry James 9f2631
     }
Jerry James 9f2631
     syBuf[1].echo = syBuf[1].fp = fileno(stdout); 
Jerry James 9f2631
     syBuf[1].bufno = -1;
Jerry James 9f2631
-    if ( isatty( fileno(stderr) ) ) {
Jerry James 9f2631
-        if ( isatty( fileno(stdin) )
Jerry James 9f2631
+    if ( isatty( fileno(stderr) ) && ttyname(fileno(stderr)) != NULL ) {
Jerry James 9f2631
+        if ( isatty( fileno(stdin) ) && ttyname(fileno(stdin)) != NULL
Jerry James 9f2631
           && ! strcmp( ttyname(fileno(stdin)), ttyname(fileno(stderr)) ) )
Jerry James 9f2631
             syBuf[2].fp = fileno(stdin);
Jerry James 9f2631
         else