From: Todd C. Miller Date: Thu, 7 May 2015 17:20:49 +0000 (-0600) Subject: Sync tty_present() with sudoers version. X-Git-Tag: SUDO_1_8_14^2~142 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=166ee6879b08c485a20a9e12b501e4297a619ef7;p=sudo Sync tty_present() with sudoers version. --- diff --git a/src/tgetpass.c b/src/tgetpass.c index a3a3f2fec..369159ade 100644 --- a/src/tgetpass.c +++ b/src/tgetpass.c @@ -333,10 +333,15 @@ tgetpass_handler(int s) static bool tty_present(void) { +#if defined(HAVE_STRUCT_KINFO_PROC2_P_TDEV) || defined(HAVE_STRUCT_KINFO_PROC_P_TDEV) || defined(HAVE_STRUCT_KINFO_PROC_KI_TDEV) || defined(HAVE_STRUCT_KINFO_PROC_KP_EPROC_E_TDEV) || defined(HAVE_STRUCT_PSINFO_PR_TTYDEV) || defined(HAVE_PSTAT_GETPROC) || defined(__linux__) + debug_decl(tty_present, SUDO_DEBUG_UTIL) + debug_return_bool(user_details.tty != NULL); +#else int fd; debug_decl(tty_present, SUDO_DEBUG_UTIL) if ((fd = open(_PATH_TTY, O_RDWR|O_NOCTTY)) != -1) close(fd); debug_return_bool(fd != -1); +#endif }