about summary refs log tree commit diff
path: root/Src/init.c
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-04-15 18:14:01 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-04-15 18:14:01 +0000
commit850fb2e7f94b4e0e9fbf3538ad9e3c44c9fed74b (patch)
treea09f4376fe75073ed19fb5dd1de0fce4c898adb9 /Src/init.c
parent7a40d6c258ad87d147ee5d6839e746c33ebc0ac7 (diff)
downloadzsh-850fb2e7f94b4e0e9fbf3538ad9e3c44c9fed74b.tar.gz
zsh-850fb2e7f94b4e0e9fbf3538ad9e3c44c9fed74b.tar.xz
zsh-850fb2e7f94b4e0e9fbf3538ad9e3c44c9fed74b.zip
zsh-3.1.5-pws-7 zsh-3.1.5-pws-7
Diffstat (limited to 'Src/init.c')
-rw-r--r--Src/init.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/Src/init.c b/Src/init.c
index 5e0a550dd..10013c52b 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -28,11 +28,12 @@
  */
 
 #include "zsh.mdh"
-#include "init.pro"
 
 #include "zshpaths.h"
 #include "zshxmods.h"
 
+#include "init.pro"
+
 /**/
 int noexitct = 0;
 
@@ -300,22 +301,19 @@ init_io(void)
 
     /* Make sure the tty is opened read/write. */
     if (isatty(0)) {
+	zsfree(ttystrname);
+	if ((ttystrname = ztrdup(ttyname(0)))) {
+	    SHTTY = movefd(open(ttystrname, O_RDWR | O_NOCTTY));
 #ifdef TIOCNXCL
-	/*
-	 * See if the terminal claims to be busy.  If so, and fd 0
-	 * is a terminal, try and set non-exclusive use for that.
-	 * This is something to do with Solaris over-cleverness.
-	 */
-	int tmpfd;
-	if ((tmpfd = open("/dev/tty", O_RDWR | O_NOCTTY)) < 0) {
-	    if (errno == EBUSY)
+	    /*
+	     * See if the terminal claims to be busy.  If so, and fd 0
+	     * is a terminal, try and set non-exclusive use for that.
+	     * This is something to do with Solaris over-cleverness.
+	     */
+	    if (SHTTY == -1 && errno == EBUSY)
 		ioctl(0, TIOCNXCL, 0);
-	} else
-	    close(tmpfd);
 #endif
-	zsfree(ttystrname);
-	if ((ttystrname = ztrdup(ttyname(0))))
-	    SHTTY = movefd(open(ttystrname, O_RDWR | O_NOCTTY));
+	}
 	/*
 	 * xterm, rxvt and probably all terminal emulators except
 	 * dtterm on Solaris 2.6 & 7 have a bug. Applications are
@@ -936,6 +934,7 @@ noop_function_int(int nothing)
     /* do nothing */
 }
 
+/**/
 # ifdef UNLINKED_XMOD_zle
 
 /**/
@@ -947,6 +946,7 @@ autoload_zleread(char *lp, char *rp, int ha)
     return zleread(lp, rp, ha);
 }
 
+/**/
 # endif /* UNLINKED_XMOD_zle */
 
 /**/