mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
lint: replace ttyname()
with ttyname_r()
This commit is contained in:
parent
edf745232f
commit
9b78857894
1 changed files with 4 additions and 2 deletions
|
@ -2,6 +2,7 @@
|
|||
#include "config.h" // IWYU pragma: keep
|
||||
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <locale.h>
|
||||
#include <pthread.h>
|
||||
#include <pwd.h>
|
||||
|
@ -447,8 +448,9 @@ static bool does_term_support_setting_title() {
|
|||
if (term_str == L"linux") return false;
|
||||
if (term_str == L"dumb") return false;
|
||||
|
||||
char *n = ttyname(STDIN_FILENO);
|
||||
if (!n || strstr(n, "tty") || strstr(n, "/vc/")) return false;
|
||||
char buf[PATH_MAX];
|
||||
int retval = ttyname_r(STDIN_FILENO, buf, PATH_MAX);
|
||||
if (retval != 0 || strstr(buf, "tty") || strstr(buf, "/vc/")) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue