Skip to content

Instantly share code, notes, and snippets.

@hnw
Created September 29, 2013 11:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hnw/6751590 to your computer and use it in GitHub Desktop.
Save hnw/6751590 to your computer and use it in GitHub Desktop.
diff -c -r zsh-5.0.2-orig/Src/init.c zsh-5.0.2/Src/init.c
*** zsh-5.0.2-orig/Src/init.c 2012-11-10 06:53:12.000000000 +0900
--- zsh-5.0.2/Src/init.c 2013-09-29 19:41:06.000000000 +0900
***************
*** 504,509 ****
--- 504,510 ----
/* Make sure the tty is opened read/write. */
if (isatty(0)) {
zsfree(ttystrname);
+ #ifdef HAVE_TTYNAME
if ((ttystrname = ztrdup(ttyname(0)))) {
SHTTY = movefd(open(ttystrname, O_RDWR | O_NOCTTY));
#ifdef TIOCNXCL
***************
*** 516,521 ****
--- 517,523 ----
ioctl(0, TIOCNXCL, 0);
#endif
}
+ #endif
/*
* xterm, rxvt and probably all terminal emulators except
* dtterm on Solaris 2.6 & 7 have a bug. Applications are
***************
*** 540,545 ****
--- 542,548 ----
SHTTY = movefd(dup(0));
}
}
+ #ifdef HAVE_TTYNAME
if (SHTTY == -1 && isatty(1) && rdwrtty(1) &&
(SHTTY = movefd(dup(1))) != -1) {
zsfree(ttystrname);
***************
*** 550,555 ****
--- 553,559 ----
zsfree(ttystrname);
ttystrname = ztrdup(ttyname(SHTTY));
}
+ #endif
if (SHTTY == -1) {
zsfree(ttystrname);
ttystrname = ztrdup("");
diff -c -r zsh-5.0.2-orig/configure.ac zsh-5.0.2/configure.ac
*** zsh-5.0.2-orig/configure.ac 2012-09-10 03:26:47.000000000 +0900
--- zsh-5.0.2/configure.ac 2013-09-29 19:55:56.000000000 +0900
***************
*** 1210,1215 ****
--- 1210,1216 ----
fstat lstat lchown fchown fchmod \
fseeko ftello \
mkfifo _mktemp mkstemp \
+ ttyname \
waitpid wait3 \
sigaction sigblock sighold sigrelse sigsetmask sigprocmask \
killpg setpgid setpgrp tcsetpgrp tcgetattr nice \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment