Re: PROBLEM: Wrong entry in file '/proc/stat' causes 'kpm' (from KDE) to

Tom Eastep (eastep@loc1.tandem.com)
Fri, 19 Mar 1999 05:09:42 +0000


This is a multi-part message in MIME format.
--------------93DCAAB538146C5C6CC16742
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Peter Englmaier wrote:
>
> Hello,
>
> here is my first bug report:
>
> [1.] One line summary of the problem:
> Wrong entry in file '/proc/stat' causes 'kpm' (from KDE) to crash
>

Attached is a gross hack against kpm from kde1.1 that gets around this
problem.

-Tom

-- 
Tom Eastep
Compaq Computer Corporation
Enterprise Computing Group
Tandem Division
tom.eastep@compaq.com
--------------93DCAAB538146C5C6CC16742
Content-Type: text/plain; charset=us-ascii;
 name="patch-kpm"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="patch-kpm"

--- kdeutils-1.1/kpm/proc.C~ Tue Nov 10 12:41:05 1998 +++ kdeutils-1.1/kpm/proc.C Sat Feb 20 08:59:45 1999 @@ -59,8 +59,8 @@ int Procinfo::readproc(int proc_pid) { char path[256]; - char buf[256]; - char sbuf[384]; // should be enough to acommodate /proc/X/stat + char buf[1024]; + char sbuf[1024]; // should be enough to acommodate /proc/X/stat char cmdbuf[MAX_CMD_LEN]; sprintf(path, "%s/%d", procdir, proc_pid); @@ -157,7 +157,7 @@ void Procinfo::read_loadavg() { char path[80]; - char buf[512]; + char buf[1024]; strcpy(path, procdir); strcat(path, "/loadavg"); if(read_file(path, buf, sizeof(buf)) <= 0) { @@ -172,7 +172,7 @@ void Procinfo::read_common() { char path[80]; - char buf[512]; + char buf[1024]; // read memory info strcpy(path, procdir); @@ -268,7 +268,7 @@ FILE *f = fopen(path, "r"); if(!f) return FALSE; - char buf[256]; + char buf[1024]; while(fgets(buf, sizeof(buf), f) != 0) { Sockinfo *si = new Sockinfo(); si->proto = proto;

--------------93DCAAB538146C5C6CC16742--

- 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/