]> granicus.if.org Git - sudo/commitdiff
Sync tty_present() with sudoers version.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 7 May 2015 17:20:49 +0000 (11:20 -0600)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 7 May 2015 17:20:49 +0000 (11:20 -0600)
src/tgetpass.c

index a3a3f2fec1ecbbfea6d8e17a55d654b20325cd88..369159ade03965413e048ef08e0f4818ac02d406 100644 (file)
@@ -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
 }