diff options
author | Ali Saidi <saidi@eecs.umich.edu> | 2008-10-01 16:37:49 -0400 |
---|---|---|
committer | Ali Saidi <saidi@eecs.umich.edu> | 2008-10-01 16:37:49 -0400 |
commit | 0bd9bbae4c9642933b4a0f7bc8de42eed0c20b2a (patch) | |
tree | 8689bca7b0cf223bc4271a28b3c795f1961cf2ef | |
parent | 4ba87133bd0840b1d718de5a605112ca634f66c7 (diff) | |
download | gem5-0bd9bbae4c9642933b4a0f7bc8de42eed0c20b2a.tar.xz |
Cleanup m5term changes with Nate's comments.
-rw-r--r-- | util/term/term.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/util/term/term.c b/util/term/term.c index 8478b74c9..54924c0e1 100644 --- a/util/term/term.c +++ b/util/term/term.c @@ -155,16 +155,15 @@ readwrite(int nfd) if (nfd == -1) return; - FD_ZERO(&read_fds); - - FD_SET(wfd, &read_fds); - FD_SET(nfd, &read_fds); max_fd = nfd + 1; - timeout.tv_sec = 1; - timeout.tv_usec = 0; - while (1) { + FD_ZERO(&read_fds); + FD_SET(wfd, &read_fds); + FD_SET(nfd, &read_fds); + timeout.tv_sec = 1; + timeout.tv_usec = 0; + n = select(max_fd, &read_fds, NULL, NULL, &timeout); if (n < 0) { close(nfd); @@ -174,7 +173,7 @@ readwrite(int nfd) if (n == 0) { if (read(nfd, buf, 0) < 0) return; - goto setup_select; + continue; } if (read(nfd, buf, 0) < 0) @@ -218,12 +217,6 @@ readwrite(int nfd) 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 } |