Fix bug in login_tty()

This commit is contained in:
Justine Tunney 2023-10-16 00:40:55 -07:00
parent ed17d3008b
commit a09f62141d
No known key found for this signature in database
GPG key ID: BE714B4575D6E328

View file

@ -53,9 +53,9 @@ int login_tty(int fd) {
errno = e; errno = e;
// take control of teletypewriter (requires being leader) // take control of teletypewriter (requires being leader)
if ((rc = sys_ioctl(fd, TIOCSCTTY, 0)) != -1) { if ((rc = sys_ioctl(fd, TIOCSCTTY, 0)) != -1) {
unassert(!sys_dup2(fd, 0, 0)); unassert(sys_dup2(fd, 0, 0) == 0);
unassert(!sys_dup2(fd, 1, 0)); unassert(sys_dup2(fd, 1, 0) == 1);
unassert(!sys_dup2(fd, 2, 0)); unassert(sys_dup2(fd, 2, 0) == 2);
if (fd > 2) { if (fd > 2) {
unassert(!sys_close(fd)); unassert(!sys_close(fd));
} }