Nagios 4.1.1: lib/runcmd.c doesn't compile on AIX 7.1

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
wolz
Posts: 1
Joined: Wed May 25, 2016 1:17 pm

Nagios 4.1.1: lib/runcmd.c doesn't compile on AIX 7.1

Post by wolz »

I am getting the following message:

Code: Select all

# make
gcc -Wall -g -O2 -DHAVE_CONFIG_H -c runcmd.c -o runcmd.o
runcmd.c: In function 'runcmd_init':
runcmd.c:311: error: lvalue required as left operand of assignment
make: *** [runcmd.o] Error 1

Code: Select all

Looking at runcmd.c (I've added line numbers):
305: void runcmd_init(void)
306: {
307: #if defined(RLIMIT_NOFILE)
308:         if (!maxfd) {
309:                 struct rlimit rlim;
310:                 getrlimit(RLIMIT_NOFILE, &rlim);
311:                 maxfd = rlim.rlim_cur;
312:         }
313: #elif !defined(OPEN_MAX) && !defined(IOV_MAX) && defined(_SC_OPEN_MAX)
314:         if(!maxfd) {
315:                 if((maxfd = sysconf(_SC_OPEN_MAX)) < 0) {
316:                         /* possibly log or emit a warning here, since there's no
317:                          * guarantee that our guess at maxfd will be adequate */
318:                         maxfd = 256;
319:                 }
320:         }
321: #endif
322: 
323:         if (!pids)
324:                 pids = calloc(maxfd, sizeof(pid_t));
325: }
To the untrained eye this looks like it should compile. Any ideas?
Last edited by mcapra on Wed May 25, 2016 1:46 pm, edited 1 time in total.
Reason: please wrap long/technical outputs in [code] tags
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Nagios 4.1.1: lib/runcmd.c doesn't compile on AIX 7.1

Post by tmcdonald »

This is going to need to be run by our C dev, I think. I'll grab his ear tomorrow and see what he thinks, I know he has been doing some work on AIX recently.
Former Nagios employee
jfrickson

Re: Nagios 4.1.1: lib/runcmd.c doesn't compile on AIX 7.1

Post by jfrickson »

On line 66, change from static int maxfd = 0; to int maxfd = 0; -- i.e., get rid of the "static" keyword.

That should do it.
Locked