@@ -47,6 +47,8 @@ int tcsetpgrp(int fd, pid_t pgrp);
int brk(void* addr);
void* sbrk(ssize_t increment);
+int isatty(int fd);
+
#ifdef __cplusplus
}
#endif
@@ -245,3 +245,8 @@ void* sbrk(ssize_t increment)
return curr_brk += increment;
return (void*)-1;
+int isatty(int fd)
+{
+ return tcgetpgrp(fd) != -1;
+}
@@ -400,7 +400,10 @@ int _syscall_ioctl(interrupt_stack* data)
// not. and we suppose that stdin will be
// either a tty or a pipe.
auto* file = current_process->files[fd];
- if (!file || file->type != fs::file::types::ind)
+ if (!file)
+ return -EBADF;
+ if (file->type != fs::file::types::ind)
return -ENOTTY;
switch (request) {