Messages in this thread | | | Date | Tue, 23 Feb 1999 15:53:47 +0100 | From | Romano Giannetti <> | Subject | Re: xosview-1.7.0 hang on 2.2.2 SMP |
| |
On Tue, Feb 23, 1999 at 02:08:27PM +0100, Ingo Molnar wrote: > > On Tue, 23 Feb 1999 SMajer@advance-bank.de wrote: > > > Everything seems to run fine except xosview. > > Steve VanDevender has posted a fix for xosview recently: >
> --- xosview-1.6.1.a/linux/cpumeter.cc.old Fri Apr 3 09:17:19 1998 > +++ xosview-1.6.1.a/linux/cpumeter.cc Fri Feb 19 20:55:01 1999 > @@ -48,7 +48,7 @@ > > void CPUMeter::getcputime( void ){ > total_ = 0; > - char tmp[256]; > + char tmp[4096]; > ifstream stats( STATFILENAME ); > > if ( !stats ){ > @@ -58,7 +58,7 @@ > > // read until we are at the right line. > for (int i = 0 ; i < _lineNum ; i++) > - stats.getline(tmp, 256); > + stats.getline(tmp, sizeof(tmp)); > > stats >>tmp >>cputime_[cpuindex_][0] > >>cputime_[cpuindex_][1] > @@ -86,9 +86,9 @@ > } > > int line = -1; > - char buf[256]; > + char buf[4096]; > while (!stats.eof()){ > - stats.getline(buf, 256); > + stats.getline(buf, sizeof(buf)); > if (!stats.eof()){ > line++; > if (!strncmp(cpuID, buf, strlen(cpuID)) && buf[strlen(cpuID)] == ' ') > @@ -111,9 +111,9 @@ > } > > int cpuCount = 0; > - char buf[256]; > + char buf[4096]; > while (!stats.eof()){ > - stats.getline(buf, 256); > + stats.getline(buf, sizeof(buf)); > if (!stats.eof()){ > if (!strncmp(buf, "cpu", 3) && buf[3] != ' ') > cpuCount++; >
There are two more place (in linux/cpumeter.cc and pagemeter.cc) to fix the same way around. And, not to be pedantic, should not be stats.getline(buf, sizeof(buf)-1)?
Romano
-- Romano Giannetti, Professor - Univ. Pontificia Comillas (Madrid, Spain) Electronic Engineer - phone +34 915 422 800 ext 2410 fax +34 915 596 569
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |