various: clean up isatty() handling
As per https://github.com/systemd/systemd/pull/30547#discussion_r1434371627
This commit is contained in:
+3
-2
@@ -30,8 +30,9 @@ static int write_to_terminal(const char *tty, const char *message) {
|
||||
fd = open(tty, O_WRONLY|O_NONBLOCK|O_NOCTTY|O_CLOEXEC);
|
||||
if (fd < 0)
|
||||
return -errno;
|
||||
if (!isatty(fd))
|
||||
return -ENOTTY;
|
||||
|
||||
if (!isatty_safe(fd))
|
||||
return -errno;
|
||||
|
||||
return loop_write_full(fd, message, SIZE_MAX, TIMEOUT_USEC);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user