[ZBX-10819] Cannot compile Zabbix server/proxy on Solaris 10 Created: 2016 May 18 Updated: 2017 May 30 Resolved: 2016 Jun 07 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Proxy (P), Server (S) |
Affects Version/s: | 3.0.1, 3.0.2 |
Fix Version/s: | 2.0.19rc1, 2.2.14rc1, 3.0.4rc1, 3.2.0alpha1 |
Type: | Incident report | Priority: | Major |
Reporter: | Anton Alekseev | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 0 |
Labels: | proxy, server, solaris | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified | ||
Environment: |
Solaris 10 SPARC |
Description |
Compilation of Zabbix server/proxy on Solaris SPARC fails with error: snmptrapper.c: In function `read_traps': snmptrapper.c:416: error: `INT_MAX' undeclared (first use in this function) snmptrapper.c:416: error: (Each undeclared identifier is reported only once snmptrapper.c:416: error: for each function it appears in.) snmptrapper.c: In function `open_trap_file': snmptrapper.c:475: error: `INT_MAX' undeclared (first use in this function) snmptrapper.c: In function `get_latest_data': snmptrapper.c:541: error: `INT_MAX' undeclared (first use in this function) I solved it by replacing INT_MAX with ZBX_MAX_UINT64 in file src/zabbix_server/snmptrapper/snmptrapper.c: 416c416 < if (INT_MAX < (zbx_uint64_t)trap_lastsize + nbytes) --- > if (ZBX_MAX_UINT64 < (zbx_uint64_t)trap_lastsize + nbytes) 475c475 < if (INT_MAX < file_buf.st_size) --- > if (ZBX_MAX_UINT64 < file_buf.st_size) 541c541 < else if (INT_MAX < file_buf.st_size) --- > else if (ZBX_MAX_UINT64 < file_buf.st_size) There were the issues like this before: |
Comments |
Comment by Glebs Ivanovskis (Inactive) [ 2016 May 18 ] |
You are probably the first man to compile Zabbix server and proxy on Solaris! Your solution does not seem correct to me, because INT_MAX is not used there to check for numeric overflow, but to restrict SNMP trap file. This piece of code clearly shows this: if (INT_MAX < file_buf.st_size) { if (0 == overflow_warning) { zabbix_log(LOG_LEVEL_CRIT, "cannot process SNMP trapper file \"%s\":" " file size exceeds the maximum supported size of 2 GB", CONFIG_SNMPTRAP_FILE); overflow_warning = 1; } goto out; } Proper solution would be to #define ZBX_MAX_SNMP_TRAP_FILE (2 * ZBX_GIBIBYTE) and use it in snmptrapper.c instead of INT_MAX. (Actually, one should be very cautious with int overflow in #define.) Caused by |
Comment by Viktors Tjarve [ 2016 Jun 02 ] |
Tested on Solaris 10 |
Comment by Alexander Vladishev [ 2016 Jun 06 ] |
(1) compilation warnings: In file included from snmptrapper.c:20:0: snmptrapper.c: In function ‘read_traps’: ../../../include/common.h:859:39: warning: integer overflow in expression [-Woverflow] #define ZBX_SNMP_TRAPFILE_MAX_SIZE (2 * ZBX_GIBIBYTE) ^ snmptrapper.c:405:7: note: in expansion of macro ‘ZBX_SNMP_TRAPFILE_MAX_SIZE’ if (ZBX_SNMP_TRAPFILE_MAX_SIZE < (zbx_uint64_t)trap_lastsize + nbytes) ^ snmptrapper.c: In function ‘open_trap_file’: ../../../include/common.h:859:39: warning: integer overflow in expression [-Woverflow] #define ZBX_SNMP_TRAPFILE_MAX_SIZE (2 * ZBX_GIBIBYTE) ^ snmptrapper.c:464:6: note: in expansion of macro ‘ZBX_SNMP_TRAPFILE_MAX_SIZE’ if (ZBX_SNMP_TRAPFILE_MAX_SIZE < file_buf.st_size) ^ snmptrapper.c: In function ‘get_latest_data’: ../../../include/common.h:859:39: warning: integer overflow in expression [-Woverflow] #define ZBX_SNMP_TRAPFILE_MAX_SIZE (2 * ZBX_GIBIBYTE) ^ snmptrapper.c:530:12: note: in expansion of macro ‘ZBX_SNMP_TRAPFILE_MAX_SIZE’ else if (ZBX_SNMP_TRAPFILE_MAX_SIZE < file_buf.st_size) ^ sasha RESOLVED in r60517 viktors.tjarve CLOSED |
Comment by Alexander Vladishev [ 2016 Jun 06 ] |
Successfully tested! Close (1) before a merge. |
Comment by Viktors Tjarve [ 2016 Jun 06 ] |
(2) compilation warnings: snmptrapper.c: In function ‘open_trap_file’: snmptrapper.c:464:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (ZBX_SNMP_TRAPFILE_MAX_SIZE <= file_buf.st_size) ^ snmptrapper.c: In function ‘get_latest_data’: snmptrapper.c:530:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] else if (ZBX_SNMP_TRAPFILE_MAX_SIZE <= file_buf.st_size) viktors.tjarve RESOLVED in r60527 sasha Thanks! CLOSED |
Comment by Viktors Tjarve [ 2016 Jun 07 ] |
Released in:
|