2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-09-05 00:35:14 +00:00

sudo_term_is_raw: only try to lock the fd if it is a tty

This moves sudo_isatty() to libsudo_util so sudo_term_is_raw() can
use it.  Fixes GitHub issue #335
This commit is contained in:
Todd C. Miller
2023-12-09 12:54:56 -07:00
parent d17e28ad61
commit 1e03cbd0b4
6 changed files with 42 additions and 30 deletions

View File

@@ -325,6 +325,8 @@ extern int (*sudo_printf)(int msg_type, const char * restrict fmt, ...);
/* term.c */
#define SUDO_TERM_ISIG 0x01U
#define SUDO_TERM_OFLAG 0x02U
sudo_dso_public bool sudo_isatty_v1(int fd, struct stat *sbp);
#define sudo_isatty(_a, _b) sudo_isatty_v1((_a), (_b))
sudo_dso_public bool sudo_term_cbreak_v1(int fd);
#define sudo_term_cbreak(_a) sudo_term_cbreak_v1((_a))
sudo_dso_public bool sudo_term_copy_v1(int src, int dst);