mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +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 "config.h" // IWYU pragma: keep
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <limits.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <pwd.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"linux") return false;
|
||||||
if (term_str == L"dumb") return false;
|
if (term_str == L"dumb") return false;
|
||||||
|
|
||||||
char *n = ttyname(STDIN_FILENO);
|
char buf[PATH_MAX];
|
||||||
if (!n || strstr(n, "tty") || strstr(n, "/vc/")) return false;
|
int retval = ttyname_r(STDIN_FILENO, buf, PATH_MAX);
|
||||||
|
if (retval != 0 || strstr(buf, "tty") || strstr(buf, "/vc/")) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue