[4476] in RedHat Linux List
procps-1.01 ps -f bug & fix
daemon@ATHENA.MIT.EDU (Krzysztof Halasa)
Fri Nov 15 03:17:05 1996
Date: Fri, 15 Nov 1996 09:10:13 +0100
From: Krzysztof Halasa <khc@hq.pm.waw.pl>
To: cblake@bbn.com
Cc: redhat-list@redhat.com
Cc: khc@hq.pm.waw.pl
Resent-From: redhat-list@redhat.com
Reply-To: redhat-list@redhat.com
Hi,
There is a bug in procps-1.01 ps.c file. ps segfaults when launched with
"-axf" ("f" is important) on system with more than 64 processes. Hand-made
fix follows (file ps.c):
void add_node(char *s, proc_t *task) {
if (maxnodes == 0) {
maxnodes = 64;
node = (struct tree_node *)
malloc(sizeof(struct tree_node) * maxnodes);
}
- if (nodes > maxnodes) {
+ if (nodes >= maxnodes) {
maxnodes *= 2;
node = (struct tree_node *)
realloc(node, sizeof(struct tree_node) * maxnodes);
}
node[nodes].proc = task;
node[nodes].pid = task->pid;
node[nodes].ppid = task->ppid;
node[nodes].line = strdup(s);
node[nodes].cmd = task->cmd;
node[nodes].cmdline = task->cmdline;
node[nodes].environ = task->environ;
node[nodes].children = 0;
node[nodes].have_parent = 0;
nodes++;
}
Please reply to <khc@hq.pm.waw.pl> if required.
--
Krzysztof Halasa
Network Administrator of The Palace of Youth in Warsaw
--
PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
________________________________________________________________________
http://www.redhat.com/RedHat-FAQ http://www.redhat.com/RedHat-Errata
http://www.redhat.com/RedHat-Tips http://www.redhat.com/mailing-lists
------------------------------------------------------------------------
To unsubscribe: mail -s unsubscribe redhat-list-request@redhat.com < /dev/null