1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:47:35 +00:00

more: Read keystrokes from stdout instead of trying to re-open it

If we're running more on a TTY that we don't have filesystem access to,
we can't rely on open(ttyname(STDOUT_FILENO)). Since all the stdio fd's
are opened read/write anyway, we can just read from stdout, even if it
feels a bit weird. :^)
This commit is contained in:
Andreas Kling 2020-02-08 15:50:00 +01:00
parent 1037a1d2ba
commit 8325662186

View file

@ -50,11 +50,7 @@ int main(int argc, char** argv)
return 1;
}
key_fd = open(ttyname(1), O_RDONLY);
if (key_fd < 0) {
perror("open");
return 1;
}
key_fd = STDOUT_FILENO;
struct winsize ws;
ioctl(1, TIOCGWINSZ, &ws);