@@ -150,9 +150,8 @@ int save_term(enum save_term_flags flags)
: open("/dev/tty", O_RDWR);
if (term_fd < 0)
return -1;
- if (full_duplex && !is_controlling_terminal(term_fd)) {
- close(term_fd);
- term_fd = -1;
+ if (flags & SAVE_TERM_DUPLEX && !is_controlling_terminal(term_fd)) {
+ close_term_fd();
return -1;
}
if (tcgetattr(term_fd, &old_term) < 0)
@@ -55,7 +55,7 @@ static int prepare_term(const char *editor)
git_config_get_bool("editor.stty", &need_saverestore);
if (need_saverestore)
- return save_term(1);
+ return save_term(SAVE_TERM_DUPLEX);
return 0;
}