Jorge, you were 100% correct. I applied the following patch
and everything works just fine now. Thanks, Grahame.



diff -cr linux-original/cpumeter.cc linux/cpumeter.cc
*** linux-original/cpumeter.cc  Thu Feb 25 09:17:18 1999
--- linux/cpumeter.cc   Thu Feb 25 09:19:56 1999
***************
*** 49,55 ****
  
  void CPUMeter::getcputime( void ){
    total_ = 0;
!   char tmp[256];
    ifstream stats( STATFILENAME );
  
    if ( !stats ){
--- 49,55 ----
  
  void CPUMeter::getcputime( void ){
    total_ = 0;
!   char tmp[BUFFSIZE];
    ifstream stats( STATFILENAME );
  
    if ( !stats ){
***************
*** 59,65 ****
  
    // read until we are at the right line.
    for (int i = 0 ; i < _lineNum ; i++)
!     stats.getline(tmp, 256);
  
    stats >>tmp >>cputime_[cpuindex_][0]  
              >>cputime_[cpuindex_][1]  
--- 59,65 ----
  
    // read until we are at the right line.
    for (int i = 0 ; i < _lineNum ; i++)
!     stats.getline(tmp, BUFFSIZE);
  
    stats >>tmp >>cputime_[cpuindex_][0]  
              >>cputime_[cpuindex_][1]  
***************
*** 87,95 ****
    }
  
    int line = -1;
!   char buf[256];
    while (!stats.eof()){
!     stats.getline(buf, 256);
      if (!stats.eof()){
        line++;
        if (!strncmp(cpuID, buf, strlen(cpuID)) && buf[strlen(cpuID)] == ' ')
--- 87,95 ----
    }
  
    int line = -1;
!   char buf[BUFFSIZE];
    while (!stats.eof()){
!     stats.getline(buf, BUFFSIZE);
      if (!stats.eof()){
        line++;
        if (!strncmp(cpuID, buf, strlen(cpuID)) && buf[strlen(cpuID)] == ' ')
***************
*** 112,120 ****
    }
  
    int cpuCount = 0;
!   char buf[256];
    while (!stats.eof()){
!     stats.getline(buf, 256);
      if (!stats.eof()){
        if (!strncmp(buf, "cpu", 3) && buf[3] != ' ')
            cpuCount++;
--- 112,120 ----
    }
  
    int cpuCount = 0;
!   char buf[BUFFSIZE];
    while (!stats.eof()){
!     stats.getline(buf, BUFFSIZE);
      if (!stats.eof()){
        if (!strncmp(buf, "cpu", 3) && buf[3] != ' ')
            cpuCount++;
***************
*** 137,144 ****
  }
  
  const char *CPUMeter::toUpper(const char *str){
!   static char buffer[256];
!   strncpy(buffer, str, 256);
    for (char *tmp = buffer ; *tmp != '\0' ; tmp++)
      *tmp = toupper(*tmp);
  
--- 137,144 ----
  }
  
  const char *CPUMeter::toUpper(const char *str){
!   static char buffer[BUFFSIZE];
!   strncpy(buffer, str, BUFFSIZE);
    for (char *tmp = buffer ; *tmp != '\0' ; tmp++)
      *tmp = toupper(*tmp);
  
diff -cr linux-original/cpumeter.h linux/cpumeter.h
*** linux-original/cpumeter.h   Thu Feb 25 09:17:18 1999
--- linux/cpumeter.h    Thu Feb 25 09:17:54 1999
***************
*** 8,13 ****
--- 8,14 ----
  //
  #ifndef _CPUMETER_H_
  #define _CPUMETER_H_
+ #define BUFFSIZE 512
  
  #include "fieldmetergraph.h"
  


-
Linux SMP list: FIRST see FAQ at http://www.irisa.fr/prive/mentre/smp-faq/
To Unsubscribe: send "unsubscribe linux-smp" to [EMAIL PROTECTED]

Reply via email to