|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT/NEWLIB PATCH v2 5/5] Implement isatty
Reviewed-by: Costin Lupu <costin.lupu@xxxxxxxxx>
On 6/2/19 7:13 PM, Vlad-Andrei BĂDOIU (78692) wrote:
> Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
> ---
> console.c | 16 ++++++++++++++--
> 1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/console.c b/console.c
> index 7016957..bf9cfe8 100644
> --- a/console.c
> +++ b/console.c
> @@ -35,11 +35,23 @@
> * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
> */
>
> +#include <errno.h>
> +#include <sys/stat.h>
> #include <uk/essentials.h>
>
> -int isatty(int file __unused)
> +int isatty(int fd)
> {
> - return 1;
> + struct stat buf;
> +
> + if (fstat(fd, &buf) < 0) {
> + errno = EBADF;
> + return 0;
> + }
> + if (S_ISCHR(buf.st_mode))
> + return 1;
> +
> + errno = ENOTTY;
> + return 0;
> }
>
> char *ttyname(int fd __unused)
>
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |