From: Mike Yuan Date: Sun, 2 Mar 2025 15:00:05 +0000 (+0100) Subject: login/pam_systemd: use isatty_safe() X-Git-Tag: v258-rc1~1206^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ffabfef9216ea31359fdcbf7b4e94f55d0374e5b;p=thirdparty%2Fsystemd.git login/pam_systemd: use isatty_safe() Follow-up for d8069b8add9a2290d7ed85012f8459fccfc632ed --- diff --git a/src/login/pam_systemd.c b/src/login/pam_systemd.c index 4c0f1a58b87..74e1406bc7a 100644 --- a/src/login/pam_systemd.c +++ b/src/login/pam_systemd.c @@ -1604,7 +1604,7 @@ static int open_osc_context(pam_handle_t *handle, const char *session_type, User * high-level for us, as it suffixes the output with a newline, expecting a full blown text message * as prompt string, not just an ANSI sequence. Note that PAM's conv_misc() actually goes to stdout * anyway, hence let's do so here too, but only after careful validation. */ - if (!isatty(STDOUT_FILENO)) + if (!isatty_safe(STDOUT_FILENO)) return PAM_SUCCESS; /* Keep a reference to the TTY we are operating on, so that we can issue the OSC close sequence also @@ -1688,7 +1688,7 @@ static int close_osc_context(pam_handle_t *handle) { fd = fd_move_above_stdio(fd); /* Safety check, let's verify this is a valid TTY we just opened */ - if (!isatty(fd)) + if (!isatty_safe(fd)) return PAM_SUCCESS; _cleanup_free_ char *osc = NULL;