Cleanup m5term changes with Nate's comments.
This commit is contained in:
parent
4ba87133bd
commit
0bd9bbae4c
1 changed files with 7 additions and 14 deletions
|
@ -155,16 +155,15 @@ readwrite(int nfd)
|
||||||
if (nfd == -1)
|
if (nfd == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FD_ZERO(&read_fds);
|
|
||||||
|
|
||||||
FD_SET(wfd, &read_fds);
|
|
||||||
FD_SET(nfd, &read_fds);
|
|
||||||
max_fd = nfd + 1;
|
max_fd = nfd + 1;
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
FD_ZERO(&read_fds);
|
||||||
|
FD_SET(wfd, &read_fds);
|
||||||
|
FD_SET(nfd, &read_fds);
|
||||||
timeout.tv_sec = 1;
|
timeout.tv_sec = 1;
|
||||||
timeout.tv_usec = 0;
|
timeout.tv_usec = 0;
|
||||||
|
|
||||||
while (1) {
|
|
||||||
n = select(max_fd, &read_fds, NULL, NULL, &timeout);
|
n = select(max_fd, &read_fds, NULL, NULL, &timeout);
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
close(nfd);
|
close(nfd);
|
||||||
|
@ -174,7 +173,7 @@ readwrite(int nfd)
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
if (read(nfd, buf, 0) < 0)
|
if (read(nfd, buf, 0) < 0)
|
||||||
return;
|
return;
|
||||||
goto setup_select;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (read(nfd, buf, 0) < 0)
|
if (read(nfd, buf, 0) < 0)
|
||||||
|
@ -218,12 +217,6 @@ readwrite(int nfd)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setup_select:
|
|
||||||
FD_ZERO(&read_fds);
|
|
||||||
FD_SET(wfd, &read_fds);
|
|
||||||
FD_SET(nfd, &read_fds);
|
|
||||||
timeout.tv_sec = 1;
|
|
||||||
timeout.tv_usec = 0;
|
|
||||||
} // while
|
} // while
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue