mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 04:13:08 +00:00
lint: replace ctermid()
with ctermid_r()
This commit is contained in:
parent
5659898331
commit
edf745232f
2 changed files with 16 additions and 0 deletions
11
configure.ac
11
configure.ac
|
@ -417,6 +417,17 @@ fi
|
|||
# features that Autoconf doesn't tell us about
|
||||
#
|
||||
|
||||
dnl AC_CHECK_FUNCS uses C linkage, but sometimes (Solaris!) the behaviour is
|
||||
dnl different with C++.
|
||||
AC_MSG_CHECKING([if ctermid_r() available])
|
||||
AC_TRY_LINK( [ #include <stdio.h> ],
|
||||
[ char buf[L_ctermid]; char *foo = ctermid_r(buf); ],
|
||||
[ AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_CTERMID_R, 1, Define to 1 if you have the `ctermid_r' function.)
|
||||
],
|
||||
[AC_MSG_RESULT(no)],
|
||||
)
|
||||
|
||||
#
|
||||
# Check if struct winsize and TIOCGWINSZ exist
|
||||
#
|
||||
|
|
|
@ -1520,7 +1520,12 @@ static bool check_for_orphaned_process(unsigned long loop_count, pid_t shell_pgi
|
|||
if (!we_think_we_are_orphaned && loop_count % 128 == 0) {
|
||||
// Try reading from the tty; if we get EIO we are orphaned. This is sort of bad because it
|
||||
// may block.
|
||||
#ifdef HAVE_CTERMID_R
|
||||
char buf[L_ctermid];
|
||||
char *tty = ctermid_r(buf);
|
||||
#else
|
||||
char *tty = ctermid(NULL);
|
||||
#endif
|
||||
if (!tty) {
|
||||
wperror(L"ctermid");
|
||||
exit_without_destructors(1);
|
||||
|
|
Loading…
Reference in a new issue