Re: [Nagios-devel] Problem compiling nagios 2.3.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
Guest

Re: [Nagios-devel] Problem compiling nagios 2.3.1

Post by Guest »

Andrea Gabellini wrote:
> Hi,
>
> I'm using various solaris versions, from 5.7 to 5.10.
>
> An usable header file is iso/limits_iso.h except for solaris 5.7 where
> the header fiele is limits.h.
>
> As a workaround I'm using, in cgi/getcgi.c:
>
> #ifndef INT_MAX
> #define INT_MAX 2147483647
> #endif
>

A more portable way is to write

#ifndef CHAR_BIT
# define CHAR_BIT 8 /* true for any system created post-woodstock */
#endif
#ifndef INT_MAX
# define INT_MAX (1 < ((sizeof(int) * CHAR_BIT) - 1))
#endif

which always gets it right and works no matter the bitwidth of int on
your system.

The way with a fixed number will appear to work where int is 64-bit, but
can break subtly in an almost completely undebuggable way.

--
Andreas Ericsson [email protected]
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231





This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked