Code

Merge branch 'collectd-5.7'
authorFlorian Forster <octo@collectd.org>
Fri, 29 Sep 2017 11:08:25 +0000 (13:08 +0200)
committerFlorian Forster <octo@collectd.org>
Fri, 29 Sep 2017 11:08:25 +0000 (13:08 +0200)
1  2 
src/dbi.c
src/email.c
src/exec.c
src/snmp.c
src/unixsock.c

diff --cc src/dbi.c
Simple merge
diff --cc src/email.c
Simple merge
diff --cc src/exec.c
index 22da3160be6c6bb7054c80f9533e8089d421910f,246584b71436b907da46e40d0de803e8a63950a6..a9f7be5c4447ad1efc2664932990f5e74d758a58
@@@ -368,11 -369,17 +368,17 @@@ static int fork_child(program_list_t *p
  
    struct passwd *sp_ptr;
    struct passwd sp;
-   char nambuf[4096];
  
    if (pl->pid != 0)
 -    return (-1);
 +    return -1;
  
+   long int nambuf_size = sysconf(_SC_GETPW_R_SIZE_MAX);
+   if (nambuf_size <= 0)
+     nambuf_size = sysconf(_SC_PAGESIZE);
+   if (nambuf_size <= 0)
+     nambuf_size = 4096;
+   char nambuf[nambuf_size];
    if ((create_pipe(fd_pipe_in) == -1) || (create_pipe(fd_pipe_out) == -1) ||
        (create_pipe(fd_pipe_err) == -1))
      goto failed;
        struct group *gr_ptr = NULL;
        struct group gr;
  
-       status = getgrnam_r(pl->group, &gr, nambuf, sizeof(nambuf), &gr_ptr);
+       long int grbuf_size = sysconf(_SC_GETGR_R_SIZE_MAX);
+       if (grbuf_size <= 0)
+         grbuf_size = sysconf(_SC_PAGESIZE);
+       if (grbuf_size <= 0)
+         grbuf_size = 4096;
+       char grbuf[grbuf_size];
+       status = getgrnam_r(pl->group, &gr, grbuf, sizeof(grbuf), &gr_ptr);
 -      if (0 != status) {
 +      if (status != 0) {
          ERROR("exec plugin: Failed to get group information "
                "for group ``%s'': %s",
                pl->group, sstrerror(status, errbuf, sizeof(errbuf)));
diff --cc src/snmp.c
Simple merge
diff --cc src/unixsock.c
Simple merge