Page 1 of 1

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

Posted: Wed May 25, 2016 1:42 pm
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?

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

Posted: Wed May 25, 2016 5:16 pm
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.

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

Posted: Thu May 26, 2016 1:20 pm
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.