mirror of https://github.com/xzeldon/htop.git
Avoid hardcoding of buffer size
This commit is contained in:
parent
443a943798
commit
95012d6259
|
@ -101,7 +101,7 @@ bool TraceScreen_forkTracer(TraceScreen* this) {
|
||||||
|
|
||||||
void TraceScreen_updateTrace(InfoScreen* super) {
|
void TraceScreen_updateTrace(InfoScreen* super) {
|
||||||
TraceScreen* this = (TraceScreen*) super;
|
TraceScreen* this = (TraceScreen*) super;
|
||||||
char buffer[1001];
|
char buffer[1025];
|
||||||
fd_set fds;
|
fd_set fds;
|
||||||
FD_ZERO(&fds);
|
FD_ZERO(&fds);
|
||||||
// FD_SET(STDIN_FILENO, &fds);
|
// FD_SET(STDIN_FILENO, &fds);
|
||||||
|
@ -111,7 +111,7 @@ void TraceScreen_updateTrace(InfoScreen* super) {
|
||||||
int ready = select(this->fd_strace+1, &fds, NULL, NULL, &tv);
|
int ready = select(this->fd_strace+1, &fds, NULL, NULL, &tv);
|
||||||
int nread = 0;
|
int nread = 0;
|
||||||
if (ready > 0 && FD_ISSET(this->fd_strace, &fds))
|
if (ready > 0 && FD_ISSET(this->fd_strace, &fds))
|
||||||
nread = fread(buffer, 1, 1000, this->strace);
|
nread = fread(buffer, 1, sizeof(buffer) - 1, this->strace);
|
||||||
if (nread && this->tracing) {
|
if (nread && this->tracing) {
|
||||||
char* line = buffer;
|
char* line = buffer;
|
||||||
buffer[nread] = '\0';
|
buffer[nread] = '\0';
|
||||||
|
|
Loading…
Reference in New Issue