Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check for read/readv if file descriptor is actually a terminal #4

Open
Mic92 opened this issue Sep 25, 2019 · 1 comment
Open

check for read/readv if file descriptor is actually a terminal #4

Mic92 opened this issue Sep 25, 2019 · 1 comment

Comments

@Mic92
Copy link

Mic92 commented Sep 25, 2019

There is a shortcut, which delegates read/readv of the file descriptor 0 (usually stdin) to a host read/readv:

return (long)host_syscall_SYS_read((int)a1, (char*)a2, (size_t)a3);

This becomes a problem if some program has used dup2 to alter the file descriptor association. This is the case for dd. The fix is not so obvious but maybe there is a way to check if fd 0 is actually the host tty.

@Mic92
Copy link
Author

Mic92 commented Sep 25, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant