From: hume-github Date: Thu, 27 Sep 2012 13:43:09 +0000 (-0300) Subject: ARG_MAX on Solaris is *very* large, 2 MB. Allocating that much on the X-Git-Tag: collectd-5.2.0~54 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=29781310b7c874032adf2bfff1386bf192f2e35c;p=collectd.git ARG_MAX on Solaris is *very* large, 2 MB. Allocating that much on the stack (local variable) overflows the thread stack and crashes the process in weird and interesting ways. "int i" is a useless variable and breaks the build with -Werror. Signed-off-by: Florian Forster --- diff --git a/src/processes.c b/src/processes.c index dcdaaf29..c77859d9 100644 --- a/src/processes.c +++ b/src/processes.c @@ -1230,10 +1230,8 @@ static int ps_read_process(int pid, procstat_t *ps, char *state) { char filename[64]; char f_psinfo[64], f_usage[64]; - int i; char *buffer; - pstatus_t *myStatus; psinfo_t *myInfo; prusage_t *myUsage; @@ -2080,7 +2078,7 @@ static int ps_read (void) procstat_t *ps_ptr; char state; - char cmdline[ARG_MAX]; + char cmdline[PRARGSZ]; ps_list_reset ();