Skip to content

Commit

Permalink
sysdeps/managarm: correctly implement tcsetattr
Browse files Browse the repository at this point in the history
  • Loading branch information
no92 committed Nov 13, 2023
1 parent 9863626 commit c6cb748
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
9 changes: 4 additions & 5 deletions sysdeps/managarm/generic/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -729,11 +729,10 @@ int sys_tcgetattr(int fd, struct termios *attr) {
}

int sys_tcsetattr(int fd, int when, const struct termios *attr) {
if(when != TCSANOW)
mlibc::infoLogger() << "\e[35mmlibc: tcsetattr() when argument ignored\e[39m"
<< frg::endlog;
int result;
if(int e = sys_ioctl(fd, TCSETS, const_cast<struct termios *>(attr), &result); e)
if(when < TCSANOW || when > TCSAFLUSH)
return EINVAL;

if(int e = sys_ioctl(fd, TCSETS, const_cast<struct termios *>(attr), nullptr); e)
return e;
return 0;
}
Expand Down
3 changes: 2 additions & 1 deletion sysdeps/managarm/generic/ioctl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ int sys_ioctl(int fd, unsigned long request, void *arg, int *result) {
managarm::fs::GenericIoctlReply<MemoryAllocator> resp(getSysdepsAllocator());
resp.ParseFromArray(recv_resp.data(), recv_resp.length());
__ensure(resp.error() == managarm::fs::Errors::SUCCESS);
*result = resp.result();
if(result)
*result = resp.result();
return 0;
}
case TIOCSCTTY: {
Expand Down

0 comments on commit c6cb748

Please sign in to comment.