-
Incident report
-
Resolution: Fixed
-
Minor
-
2.1.4
-
None
-
Solaris x86, Sun Studio 12
The strndup function is used in src/libs/zbxdbupgrade/dbupgrade.c in DBpatch_2010101 function. It is GNU function, not standard, so can't compile server and link zabbix server with SunStudio CC and guess same for other compilers except gcc.
I fix it by the following code. but couldn't be a good choice.
#Fix strndup issue on dbuphgrade.c
STRNDUP_FUNC="//#if defined(SOLARIS)||defined(_APPLE) || defined(WIN32) || defined(_FORTEC)
#define min(a,b) (a>b?b:a)
char *strndup( const char *s, size_t n )
"
echo "$STRNDUP_FUNC" >> src/libs/zbxdbupgrade/dbupgrade.c
sed '/static void parse_db_monitor_item_params.*/ i\
char *strndup( const char *s, size_t n );\
' src/libs/zbxdbupgrade/dbupgrade.c > src/libs/zbxdbupgrade/dbupgrade.c.new && mv src/libs/zbxdbupgrade/dbupgrade.c.new src/libs/zbxdbupgrade/dbupgrade.c