tree-wide: use isatty_safe() more
This commit is contained in:
@@ -1052,8 +1052,8 @@ bool on_tty(void) {
|
||||
|
||||
if (cached_on_tty < 0)
|
||||
cached_on_tty =
|
||||
isatty(STDOUT_FILENO) > 0 &&
|
||||
isatty(STDERR_FILENO) > 0;
|
||||
isatty_safe(STDOUT_FILENO) &&
|
||||
isatty_safe(STDERR_FILENO);
|
||||
|
||||
return cached_on_tty;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "random-util.h"
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "terminal-util.h"
|
||||
#include "user-util.h"
|
||||
#include "utf8.h"
|
||||
|
||||
@@ -120,7 +121,7 @@ char* getlogname_malloc(void) {
|
||||
uid_t uid;
|
||||
struct stat st;
|
||||
|
||||
if (isatty(STDIN_FILENO) && fstat(STDIN_FILENO, &st) >= 0)
|
||||
if (isatty_safe(STDIN_FILENO) && fstat(STDIN_FILENO, &st) >= 0)
|
||||
uid = st.st_uid;
|
||||
else
|
||||
uid = getuid();
|
||||
|
||||
Reference in New Issue
Block a user