FreeBSD Bugzilla – Attachment 16966 Details for
Bug 30939
top(1) behaves badly when it loses terminal
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 1.25 KB, created by
andrew
on 2001-09-30 20:30:00 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
andrew
Created:
2001-09-30 20:30:00 UTC
Size:
1.25 KB
patch
obsolete
>--- contrib/top/top.c.orig Sun Sep 30 21:30:08 2001 >+++ contrib/top/top.c Sun Sep 30 22:51:23 2001 >@@ -157,6 +157,7 @@ > int topn = Default_TOPN; > int delay = Default_DELAY; > int displays = 0; /* indicates unspecified */ >+ int sel_ret = 0; > time_t curr_time; > char *(*get_userid)() = username; > char *uname_field = "USERNAME"; >@@ -711,7 +712,9 @@ > } > > /* wait for either input or the end of the delay period */ >- if (select(32, &readfds, (fd_set *)NULL, (fd_set *)NULL, &timeout) > 0) >+ sel_ret = select(2, &readfds, (fd_set *)NULL, (fd_set *)NULL, >+ &timeout); >+ if (sel_ret > 0) > { > int newval; > char *errmsg; >@@ -721,7 +724,12 @@ > > /* now read it and convert to command strchr */ > /* (use "change" as a temporary to hold strchr) */ >- (void) read(0, &ch, 1); >+ /* sleep if input from stdin causes error */ >+ if (read(0, &ch, 1) != 1) >+ { >+ ch = '\r'; >+ sleep(delay); >+ } > if ((iptr = strchr(command_chars, ch)) == NULL) > { > if (ch != '\r' && ch != '\n') >@@ -960,6 +968,11 @@ > > /* flush out stuff that may have been written */ > fflush(stdout); >+ } >+ /* sleep if input from stdin causes error */ >+ if (sel_ret < 0) >+ { >+ sleep(delay); > } > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 30939
: 16966