From: Florian Forster Date: Mon, 8 Sep 2014 15:11:56 +0000 (+0200) Subject: Merge remote-tracking branch 'github/master' X-Git-Tag: collectd-5.5.0~204 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=67411e0794cfcab38e322b2ebbe2e5207cbdd86a;hp=be0a3a6eeb3655d5559abe768c4027889d1ae979;p=collectd.git Merge remote-tracking branch 'github/master' --- diff --git a/src/processes.c b/src/processes.c index 5601d290..aa47f332 100644 --- a/src/processes.c +++ b/src/processes.c @@ -128,8 +128,12 @@ # include #endif -#ifndef ARG_MAX -# define ARG_MAX 4096 +#ifndef CMDLINE_BUFFER_SIZE +# if defined(ARG_MAX) && (ARG_MAX < 4096) +# define CMDLINE_BUFFER_SIZE ARG_MAX +# else +# define CMDLINE_BUFFER_SIZE 4096 +# endif #endif typedef struct procstat_entry_s @@ -1686,7 +1690,7 @@ static int ps_read (void) DIR *proc; int pid; - char cmdline[ARG_MAX]; + char cmdline[CMDLINE_BUFFER_SIZE]; int status; procstat_t ps; @@ -1824,7 +1828,7 @@ static int ps_read (void) * filter out threads (duplicate PID entries). */ if ((proc_ptr == NULL) || (proc_ptr->ki_pid != procs[i].ki_pid)) { - char cmdline[ARG_MAX] = ""; + char cmdline[CMDLINE_BUFFER_SIZE] = ""; _Bool have_cmdline = 0; proc_ptr = &(procs[i]);