Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/zbxtypes.h1
-rw-r--r--src/libs/zbxcomms/comms.c4
-rw-r--r--src/libs/zbxserver/expression.c48
-rw-r--r--src/libs/zbxsysinfo/aix/diskio.c8
-rw-r--r--src/libs/zbxsysinfo/freebsd/diskio.c8
-rw-r--r--src/libs/zbxsysinfo/linux/diskio.c4
-rw-r--r--src/zabbix_agent/listener.c2
-rw-r--r--src/zabbix_agent/zabbix_agentd.c14
-rw-r--r--src/zabbix_get/zabbix_get.c2
-rw-r--r--src/zabbix_proxy/proxy.c11
-rw-r--r--src/zabbix_sender/zabbix_sender.c2
-rw-r--r--src/zabbix_server/httppoller/httpmacro.c2
-rw-r--r--src/zabbix_server/poller/checks_simple.c4
-rw-r--r--src/zabbix_server/poller/checks_snmp.c2
-rw-r--r--src/zabbix_server/server.c11
15 files changed, 63 insertions, 60 deletions
diff --git a/include/zbxtypes.h b/include/zbxtypes.h
index f637de68f1c..47d7d0cb137 100644
--- a/include/zbxtypes.h
+++ b/include/zbxtypes.h
@@ -120,6 +120,7 @@ typedef off_t zbx_offset_t;
#define ZBX_STR2UCHAR(var, string) var = (unsigned char)atoi(string)
#define ZBX_CONST_STRING(str) ""str
+#define ZBX_CONST_STRLEN(str) (sizeof(ZBX_CONST_STRING(str)) - 1)
typedef struct
{
diff --git a/src/libs/zbxcomms/comms.c b/src/libs/zbxcomms/comms.c
index 4daa6429865..5b5fbe4eb09 100644
--- a/src/libs/zbxcomms/comms.c
+++ b/src/libs/zbxcomms/comms.c
@@ -1166,7 +1166,7 @@ ssize_t zbx_tcp_recv_ext(zbx_sock_t *s, unsigned char flags, int timeout)
if (nbytes < left) /* should we stop reading? */
{
/* XML protocol? */
- if (0 == strncmp(s->buf_stat, "<req>", sizeof("<req>") - 1))
+ if (0 == strncmp(s->buf_stat, "<req>", ZBX_CONST_STRLEN("<req>")))
{
/* closing tag received in the last 10 bytes? */
s->buf_stat[read_bytes] = '\0';
@@ -1212,7 +1212,7 @@ ssize_t zbx_tcp_recv_ext(zbx_sock_t *s, unsigned char flags, int timeout)
if ((size_t)nbytes < sizeof(s->buf_stat) - 1) /* should we stop reading? */
{
/* XML protocol? */
- if (0 == strncmp(s->buffer, "<req>", sizeof("<req>") - 1))
+ if (0 == strncmp(s->buffer, "<req>", ZBX_CONST_STRLEN("<req>")))
{
/* closing tag received in the last 10 bytes? */
if (NULL != strstr(s->buffer + read_bytes - 10, "</req>"))
diff --git a/src/libs/zbxserver/expression.c b/src/libs/zbxserver/expression.c
index f847dc8b9c1..ff3ff4ee7a6 100644
--- a/src/libs/zbxserver/expression.c
+++ b/src/libs/zbxserver/expression.c
@@ -2340,7 +2340,7 @@ int substitute_simple_macros(zbx_uint64_t *actionid, const DB_EVENT *event, DB_E
cache_trigger_hostids(&hostids, c_event->trigger.expression);
DCget_user_macro(hostids.values, hostids.values_num, m, &replace_to);
}
- else if (0 == strncmp(m, MVAR_ACTION, sizeof(MVAR_ACTION) - 1))
+ else if (0 == strncmp(m, MVAR_ACTION, ZBX_CONST_STRLEN(MVAR_ACTION)))
{
ret = get_action_value(m, *actionid, &replace_to);
}
@@ -2352,12 +2352,12 @@ int substitute_simple_macros(zbx_uint64_t *actionid, const DB_EVENT *event, DB_E
{
get_escalation_history(event, r_event, &replace_to);
}
- else if (0 == strncmp(m, MVAR_EVENT_RECOVERY, sizeof(MVAR_EVENT_RECOVERY) - 1))
+ else if (0 == strncmp(m, MVAR_EVENT_RECOVERY, ZBX_CONST_STRLEN(MVAR_EVENT_RECOVERY)))
{
if (0 != (macro_type & MACRO_TYPE_MESSAGE_RECOVERY))
get_recovery_event_value(m, r_event, &replace_to);
}
- else if (0 == strncmp(m, MVAR_EVENT, sizeof(MVAR_EVENT) - 1))
+ else if (0 == strncmp(m, MVAR_EVENT, ZBX_CONST_STRLEN(MVAR_EVENT)))
{
get_event_value(m, event, &replace_to);
}
@@ -2396,8 +2396,8 @@ int substitute_simple_macros(zbx_uint64_t *actionid, const DB_EVENT *event, DB_E
ret = DBget_trigger_value(c_event->trigger.expression, &replace_to,
N_functionid, ZBX_REQUEST_HOST_PORT);
}
- else if (0 == strncmp(m, MVAR_INVENTORY, sizeof(MVAR_INVENTORY) - 1) ||
- 0 == strncmp(m, MVAR_PROFILE, sizeof(MVAR_PROFILE) - 1))
+ else if (0 == strncmp(m, MVAR_INVENTORY, ZBX_CONST_STRLEN(MVAR_INVENTORY)) ||
+ 0 == strncmp(m, MVAR_PROFILE, ZBX_CONST_STRLEN(MVAR_PROFILE)))
{
ret = get_host_inventory(m, c_event->trigger.expression, &replace_to,
N_functionid);
@@ -2584,7 +2584,7 @@ int substitute_simple_macros(zbx_uint64_t *actionid, const DB_EVENT *event, DB_E
cache_trigger_hostids(&hostids, c_event->trigger.expression);
DCget_user_macro(hostids.values, hostids.values_num, m, &replace_to);
}
- else if (0 == strncmp(m, MVAR_ACTION, sizeof(MVAR_ACTION) - 1))
+ else if (0 == strncmp(m, MVAR_ACTION, ZBX_CONST_STRLEN(MVAR_ACTION)))
{
ret = get_action_value(m, *actionid, &replace_to);
}
@@ -2596,12 +2596,12 @@ int substitute_simple_macros(zbx_uint64_t *actionid, const DB_EVENT *event, DB_E
{
get_escalation_history(event, r_event, &replace_to);
}
- else if (0 == strncmp(m, MVAR_EVENT_RECOVERY, sizeof(MVAR_EVENT_RECOVERY) - 1))
+ else if (0 == strncmp(m, MVAR_EVENT_RECOVERY, ZBX_CONST_STRLEN(MVAR_EVENT_RECOVERY)))
{
if (0 != (macro_type & MACRO_TYPE_MESSAGE_RECOVERY))
get_recovery_event_value(m, r_event, &replace_to);
}
- else if (0 == strncmp(m, MVAR_EVENT, sizeof(MVAR_EVENT) - 1))
+ else if (0 == strncmp(m, MVAR_EVENT, ZBX_CONST_STRLEN(MVAR_EVENT)))
{
get_event_value(m, event, &replace_to);
}
@@ -2640,8 +2640,8 @@ int substitute_simple_macros(zbx_uint64_t *actionid, const DB_EVENT *event, DB_E
ret = DBget_trigger_value(c_event->trigger.expression, &replace_to,
N_functionid, ZBX_REQUEST_HOST_PORT);
}
- else if (0 == strncmp(m, MVAR_INVENTORY, sizeof(MVAR_INVENTORY) - 1) ||
- 0 == strncmp(m, MVAR_PROFILE, sizeof(MVAR_PROFILE) - 1))
+ else if (0 == strncmp(m, MVAR_INVENTORY, ZBX_CONST_STRLEN(MVAR_INVENTORY)) ||
+ 0 == strncmp(m, MVAR_PROFILE, ZBX_CONST_STRLEN(MVAR_PROFILE)))
{
ret = get_host_inventory(m, c_event->trigger.expression, &replace_to,
N_functionid);
@@ -2749,7 +2749,7 @@ int substitute_simple_macros(zbx_uint64_t *actionid, const DB_EVENT *event, DB_E
{
DCget_user_macro(NULL, 0, m, &replace_to);
}
- else if (0 == strncmp(m, MVAR_ACTION, sizeof(MVAR_ACTION) - 1))
+ else if (0 == strncmp(m, MVAR_ACTION, ZBX_CONST_STRLEN(MVAR_ACTION)))
{
ret = get_action_value(m, *actionid, &replace_to);
}
@@ -2757,7 +2757,7 @@ int substitute_simple_macros(zbx_uint64_t *actionid, const DB_EVENT *event, DB_E
{
replace_to = zbx_strdup(replace_to, zbx_date2str(time(NULL)));
}
- else if (0 == strncmp(m, MVAR_EVENT, sizeof(MVAR_EVENT) - 1))
+ else if (0 == strncmp(m, MVAR_EVENT, ZBX_CONST_STRLEN(MVAR_EVENT)))
{
get_event_value(m, event, &replace_to);
}
@@ -2872,7 +2872,7 @@ int substitute_simple_macros(zbx_uint64_t *actionid, const DB_EVENT *event, DB_E
{
DCget_user_macro(NULL, 0, m, &replace_to);
}
- else if (0 == strncmp(m, MVAR_ACTION, sizeof(MVAR_ACTION) - 1))
+ else if (0 == strncmp(m, MVAR_ACTION, ZBX_CONST_STRLEN(MVAR_ACTION)))
{
ret = get_action_value(m, *actionid, &replace_to);
}
@@ -2880,7 +2880,7 @@ int substitute_simple_macros(zbx_uint64_t *actionid, const DB_EVENT *event, DB_E
{
replace_to = zbx_strdup(replace_to, zbx_date2str(time(NULL)));
}
- else if (0 == strncmp(m, MVAR_EVENT, sizeof(MVAR_EVENT) - 1))
+ else if (0 == strncmp(m, MVAR_EVENT, ZBX_CONST_STRLEN(MVAR_EVENT)))
{
get_event_value(m, event, &replace_to);
}
@@ -2947,7 +2947,7 @@ int substitute_simple_macros(zbx_uint64_t *actionid, const DB_EVENT *event, DB_E
cache_item_hostid(&hostids, c_event->objectid);
DCget_user_macro(hostids.values, hostids.values_num, m, &replace_to);
}
- else if (0 == strncmp(m, MVAR_ACTION, sizeof(MVAR_ACTION) - 1))
+ else if (0 == strncmp(m, MVAR_ACTION, ZBX_CONST_STRLEN(MVAR_ACTION)))
{
ret = get_action_value(m, *actionid, &replace_to);
}
@@ -2959,12 +2959,12 @@ int substitute_simple_macros(zbx_uint64_t *actionid, const DB_EVENT *event, DB_E
{
get_escalation_history(event, r_event, &replace_to);
}
- else if (0 == strncmp(m, MVAR_EVENT_RECOVERY, sizeof(MVAR_EVENT_RECOVERY) - 1))
+ else if (0 == strncmp(m, MVAR_EVENT_RECOVERY, ZBX_CONST_STRLEN(MVAR_EVENT_RECOVERY)))
{
if (0 != (macro_type & MACRO_TYPE_MESSAGE_RECOVERY))
get_recovery_event_value(m, r_event, &replace_to);
}
- else if (0 == strncmp(m, MVAR_EVENT, sizeof(MVAR_EVENT) - 1))
+ else if (0 == strncmp(m, MVAR_EVENT, ZBX_CONST_STRLEN(MVAR_EVENT)))
{
get_event_value(m, event, &replace_to);
}
@@ -2997,8 +2997,8 @@ int substitute_simple_macros(zbx_uint64_t *actionid, const DB_EVENT *event, DB_E
{
ret = DBget_item_value(c_event->objectid, &replace_to, ZBX_REQUEST_HOST_PORT);
}
- else if (0 == strncmp(m, MVAR_INVENTORY, sizeof(MVAR_INVENTORY) - 1) ||
- 0 == strncmp(m, MVAR_PROFILE, sizeof(MVAR_PROFILE) - 1))
+ else if (0 == strncmp(m, MVAR_INVENTORY, ZBX_CONST_STRLEN(MVAR_INVENTORY)) ||
+ 0 == strncmp(m, MVAR_PROFILE, ZBX_CONST_STRLEN(MVAR_PROFILE)))
{
ret = get_host_inventory_by_itemid(m, c_event->objectid, &replace_to);
}
@@ -3054,7 +3054,7 @@ int substitute_simple_macros(zbx_uint64_t *actionid, const DB_EVENT *event, DB_E
cache_item_hostid(&hostids, c_event->objectid);
DCget_user_macro(hostids.values, hostids.values_num, m, &replace_to);
}
- else if (0 == strncmp(m, MVAR_ACTION, sizeof(MVAR_ACTION) - 1))
+ else if (0 == strncmp(m, MVAR_ACTION, ZBX_CONST_STRLEN(MVAR_ACTION)))
{
ret = get_action_value(m, *actionid, &replace_to);
}
@@ -3066,12 +3066,12 @@ int substitute_simple_macros(zbx_uint64_t *actionid, const DB_EVENT *event, DB_E
{
get_escalation_history(event, r_event, &replace_to);
}
- else if (0 == strncmp(m, MVAR_EVENT_RECOVERY, sizeof(MVAR_EVENT_RECOVERY) - 1))
+ else if (0 == strncmp(m, MVAR_EVENT_RECOVERY, ZBX_CONST_STRLEN(MVAR_EVENT_RECOVERY)))
{
if (0 != (macro_type & MACRO_TYPE_MESSAGE_RECOVERY))
get_recovery_event_value(m, r_event, &replace_to);
}
- else if (0 == strncmp(m, MVAR_EVENT, sizeof(MVAR_EVENT) - 1))
+ else if (0 == strncmp(m, MVAR_EVENT, ZBX_CONST_STRLEN(MVAR_EVENT)))
{
get_event_value(m, event, &replace_to);
}
@@ -3104,8 +3104,8 @@ int substitute_simple_macros(zbx_uint64_t *actionid, const DB_EVENT *event, DB_E
{
ret = DBget_item_value(c_event->objectid, &replace_to, ZBX_REQUEST_HOST_PORT);
}
- else if (0 == strncmp(m, MVAR_INVENTORY, sizeof(MVAR_INVENTORY) - 1) ||
- 0 == strncmp(m, MVAR_PROFILE, sizeof(MVAR_PROFILE) - 1))
+ else if (0 == strncmp(m, MVAR_INVENTORY, ZBX_CONST_STRLEN(MVAR_INVENTORY)) ||
+ 0 == strncmp(m, MVAR_PROFILE, ZBX_CONST_STRLEN(MVAR_PROFILE)))
{
ret = get_host_inventory_by_itemid(m, c_event->objectid, &replace_to);
}
diff --git a/src/libs/zbxsysinfo/aix/diskio.c b/src/libs/zbxsysinfo/aix/diskio.c
index f9da7c476b9..c71ad4744f0 100644
--- a/src/libs/zbxsysinfo/aix/diskio.c
+++ b/src/libs/zbxsysinfo/aix/diskio.c
@@ -165,8 +165,8 @@ int VFS_DEV_READ(AGENT_REQUEST *request, AGENT_RESULT *result)
if (NULL == devname || 0 == strcmp("all", devname))
devname = "";
- else if (0 == strncmp(ZBX_DEV_PFX, devname, sizeof(ZBX_DEV_PFX) - 1))
- devname += sizeof(ZBX_DEV_PFX) - 1;
+ else if (0 == strncmp(ZBX_DEV_PFX, devname, ZBX_CONST_STRLEN(ZBX_DEV_PFX)))
+ devname += ZBX_CONST_STRLEN(ZBX_DEV_PFX);
type = get_rparam(request, 1);
@@ -198,8 +198,8 @@ int VFS_DEV_WRITE(AGENT_REQUEST *request, AGENT_RESULT *result)
if (NULL == devname || 0 == strcmp("all", devname))
devname = "";
- else if (0 == strncmp(ZBX_DEV_PFX, devname, sizeof(ZBX_DEV_PFX) - 1))
- devname += sizeof(ZBX_DEV_PFX) - 1;
+ else if (0 == strncmp(ZBX_DEV_PFX, devname, ZBX_CONST_STRLEN(ZBX_DEV_PFX)))
+ devname += ZBX_CONST_STRLEN(ZBX_DEV_PFX);
type = get_rparam(request, 1);
diff --git a/src/libs/zbxsysinfo/freebsd/diskio.c b/src/libs/zbxsysinfo/freebsd/diskio.c
index 6795f6b1040..bb4d84a591b 100644
--- a/src/libs/zbxsysinfo/freebsd/diskio.c
+++ b/src/libs/zbxsysinfo/freebsd/diskio.c
@@ -51,8 +51,8 @@ int get_diskstat(const char *devname, zbx_uint64_t *dstat)
pd = devname;
/* skip prefix ZBX_DEV_PFX, if present */
- if ('\0' != *devname && 0 == strncmp(pd, ZBX_DEV_PFX, sizeof(ZBX_DEV_PFX) - 1))
- pd += sizeof(ZBX_DEV_PFX) - 1;
+ if ('\0' != *devname && 0 == strncmp(pd, ZBX_DEV_PFX, ZBX_CONST_STRLEN(ZBX_DEV_PFX)))
+ pd += ZBX_CONST_STRLEN(ZBX_DEV_PFX);
#if DEVSTAT_USER_API_VER >= 5
if (-1 == devstat_getdevs(NULL, si))
@@ -119,8 +119,8 @@ static int vfs_dev_rw(AGENT_REQUEST *request, AGENT_RESULT *result, int rw)
if ('\0' != *pd)
{
/* skip prefix ZBX_DEV_PFX, if present */
- if (0 == strncmp(pd, ZBX_DEV_PFX, sizeof(ZBX_DEV_PFX) - 1))
- pd += sizeof(ZBX_DEV_PFX) - 1;
+ if (0 == strncmp(pd, ZBX_DEV_PFX, ZBX_CONST_STRLEN(ZBX_DEV_PFX)))
+ pd += ZBX_CONST_STRLEN(ZBX_DEV_PFX);
}
tmp = get_rparam(request, 1);
diff --git a/src/libs/zbxsysinfo/linux/diskio.c b/src/libs/zbxsysinfo/linux/diskio.c
index f13b941e530..09a00961a16 100644
--- a/src/libs/zbxsysinfo/linux/diskio.c
+++ b/src/libs/zbxsysinfo/linux/diskio.c
@@ -83,7 +83,7 @@ int get_diskstat(const char *devname, zbx_uint64_t *dstat)
if (NULL != devname && '\0' != *devname && 0 != strcmp(devname, "all"))
{
*dev_path = '\0';
- if (0 != strncmp(devname, ZBX_DEV_PFX, sizeof(ZBX_DEV_PFX) - 1))
+ if (0 != strncmp(devname, ZBX_DEV_PFX, ZBX_CONST_STRLEN(ZBX_DEV_PFX)))
strscpy(dev_path, ZBX_DEV_PFX);
strscat(dev_path, devname);
@@ -146,7 +146,7 @@ static int get_kernel_devname(const char *devname, char *kernel_devname, size_t
return ret;
*dev_path = '\0';
- if (0 != strncmp(devname, ZBX_DEV_PFX, sizeof(ZBX_DEV_PFX) - 1))
+ if (0 != strncmp(devname, ZBX_DEV_PFX, ZBX_CONST_STRLEN(ZBX_DEV_PFX)))
strscpy(dev_path, ZBX_DEV_PFX);
strscat(dev_path, devname);
diff --git a/src/zabbix_agent/listener.c b/src/zabbix_agent/listener.c
index fad72662a3b..0dfffe8879d 100644
--- a/src/zabbix_agent/listener.c
+++ b/src/zabbix_agent/listener.c
@@ -73,7 +73,7 @@ static void process_listener(zbx_sock_t *s)
buffer = zbx_malloc(buffer, buffer_alloc);
zbx_strncpy_alloc(&buffer, &buffer_alloc, &buffer_offset,
- ZBX_NOTSUPPORTED, sizeof(ZBX_NOTSUPPORTED) - 1);
+ ZBX_NOTSUPPORTED, ZBX_CONST_STRLEN(ZBX_NOTSUPPORTED));
buffer_offset++;
zbx_strcpy_alloc(&buffer, &buffer_alloc, &buffer_offset, *value);
diff --git a/src/zabbix_agent/zabbix_agentd.c b/src/zabbix_agent/zabbix_agentd.c
index 76c11b48963..bb97b9acc36 100644
--- a/src/zabbix_agent/zabbix_agentd.c
+++ b/src/zabbix_agent/zabbix_agentd.c
@@ -233,9 +233,7 @@ int get_process_info_by_thread(int server_num, unsigned char *process_type, int
static void parse_commandline(int argc, char **argv, ZBX_TASK_EX *t)
{
char ch;
-#ifndef _WINDOWS
- int offset;
-#endif
+
t->task = ZBX_TASK_START;
/* parse the command-line */
@@ -249,9 +247,10 @@ static void parse_commandline(int argc, char **argv, ZBX_TASK_EX *t)
#ifndef _WINDOWS
case 'R':
if (0 == strncmp(zbx_optarg, ZBX_LOG_LEVEL_INCREASE,
- offset = strlen(ZBX_LOG_LEVEL_INCREASE)))
+ ZBX_CONST_STRLEN(ZBX_LOG_LEVEL_INCREASE)))
{
- if (SUCCEED != get_log_level_message(zbx_optarg + offset,
+ if (SUCCEED != get_log_level_message(
+ zbx_optarg + ZBX_CONST_STRLEN(ZBX_LOG_LEVEL_INCREASE),
ZBX_RTC_LOG_LEVEL_INCREASE, &t->flags))
{
exit(EXIT_FAILURE);
@@ -259,9 +258,10 @@ static void parse_commandline(int argc, char **argv, ZBX_TASK_EX *t)
}
else if (0 == strncmp(zbx_optarg, ZBX_LOG_LEVEL_DECREASE,
- offset = strlen(ZBX_LOG_LEVEL_DECREASE)))
+ ZBX_CONST_STRLEN(ZBX_LOG_LEVEL_DECREASE)))
{
- if (SUCCEED != get_log_level_message(zbx_optarg + offset,
+ if (SUCCEED != get_log_level_message(
+ zbx_optarg + ZBX_CONST_STRLEN(ZBX_LOG_LEVEL_DECREASE),
ZBX_RTC_LOG_LEVEL_DECREASE, &t->flags))
{
exit(EXIT_FAILURE);
diff --git a/src/zabbix_get/zabbix_get.c b/src/zabbix_get/zabbix_get.c
index 821b00cc6a8..a2fc62174b8 100644
--- a/src/zabbix_get/zabbix_get.c
+++ b/src/zabbix_get/zabbix_get.c
@@ -38,7 +38,7 @@ const char *help_message[] = {
"",
" -k --key <key of metric> Specify key of item to retrieve value for",
"",
- " -h --help Give this help",
+ " -h --help Display help information",
" -V --version Display version number",
"",
"Example: zabbix_get -s 127.0.0.1 -p " ZBX_DEFAULT_AGENT_PORT_STR " -k \"system.cpu.load[all,avg1]\"",
diff --git a/src/zabbix_proxy/proxy.c b/src/zabbix_proxy/proxy.c
index 06ba07ff9c1..6e452aaf27c 100644
--- a/src/zabbix_proxy/proxy.c
+++ b/src/zabbix_proxy/proxy.c
@@ -649,7 +649,6 @@ int main(int argc, char **argv)
{
ZBX_TASK_EX t = {ZBX_TASK_START};
char ch;
- int offset;
#if defined(PS_OVERWRITE_ARGV) || defined(PS_PSTAT_ARGV)
argv = setproctitle_save_env(argc, argv);
@@ -670,18 +669,20 @@ int main(int argc, char **argv)
t.flags = ZBX_RTC_MAKE_MESSAGE(ZBX_RTC_CONFIG_CACHE_RELOAD, 0, 0);
}
else if (0 == strncmp(zbx_optarg, ZBX_LOG_LEVEL_INCREASE,
- offset = strlen(ZBX_LOG_LEVEL_INCREASE)))
+ ZBX_CONST_STRLEN(ZBX_LOG_LEVEL_INCREASE)))
{
- if (SUCCEED != get_log_level_message(zbx_optarg + offset,
+ if (SUCCEED != get_log_level_message(
+ zbx_optarg + ZBX_CONST_STRLEN(ZBX_LOG_LEVEL_INCREASE),
ZBX_RTC_LOG_LEVEL_INCREASE, &t.flags))
{
exit(EXIT_FAILURE);
}
}
else if (0 == strncmp(zbx_optarg, ZBX_LOG_LEVEL_DECREASE,
- offset = strlen(ZBX_LOG_LEVEL_DECREASE)))
+ ZBX_CONST_STRLEN(ZBX_LOG_LEVEL_DECREASE)))
{
- if (SUCCEED != get_log_level_message(zbx_optarg + offset,
+ if (SUCCEED != get_log_level_message(
+ zbx_optarg + ZBX_CONST_STRLEN(ZBX_LOG_LEVEL_DECREASE),
ZBX_RTC_LOG_LEVEL_DECREASE, &t.flags))
{
exit(EXIT_FAILURE);
diff --git a/src/zabbix_sender/zabbix_sender.c b/src/zabbix_sender/zabbix_sender.c
index 112e8f0c682..d05166d38d2 100644
--- a/src/zabbix_sender/zabbix_sender.c
+++ b/src/zabbix_sender/zabbix_sender.c
@@ -55,7 +55,7 @@ const char *help_message[] = {
" -v --verbose Verbose mode, -vv for more details",
"",
"Other options:",
- " -h --help Give this help",
+ " -h --help Display help information",
" -V --version Display version number",
NULL /* end of text */
};
diff --git a/src/zabbix_server/httppoller/httpmacro.c b/src/zabbix_server/httppoller/httpmacro.c
index 21ae98e1d36..dfb2972bf19 100644
--- a/src/zabbix_server/httppoller/httpmacro.c
+++ b/src/zabbix_server/httppoller/httpmacro.c
@@ -25,7 +25,7 @@
#include "httpmacro.h"
#define REGEXP_PREFIX "regex:"
-#define REGEXP_PREFIX_SIZE (sizeof(REGEXP_PREFIX) - 1)
+#define REGEXP_PREFIX_SIZE ZBX_CONST_STRLEN(REGEXP_PREFIX)
/******************************************************************************
* *
diff --git a/src/zabbix_server/poller/checks_simple.c b/src/zabbix_server/poller/checks_simple.c
index daa8e46836a..948374f2945 100644
--- a/src/zabbix_server/poller/checks_simple.c
+++ b/src/zabbix_server/poller/checks_simple.c
@@ -118,12 +118,12 @@ static int get_vmware_function(const char *key, vmfunc_t *vmfunc)
{
zbx_vmcheck_t *check;
- if (0 != strncmp(key, ZBX_VMWARE_PREFIX, sizeof(ZBX_VMWARE_PREFIX) - 1))
+ if (0 != strncmp(key, ZBX_VMWARE_PREFIX, ZBX_CONST_STRLEN(ZBX_VMWARE_PREFIX)))
return FAIL;
for (check = vmchecks; NULL != check->key; check++)
{
- if (0 == strcmp(key + sizeof(ZBX_VMWARE_PREFIX) - 1, check->key))
+ if (0 == strcmp(key + ZBX_CONST_STRLEN(ZBX_VMWARE_PREFIX), check->key))
{
*vmfunc = check->func;
return SUCCEED;
diff --git a/src/zabbix_server/poller/checks_snmp.c b/src/zabbix_server/poller/checks_snmp.c
index 5b406e80065..6bbc6276da1 100644
--- a/src/zabbix_server/poller/checks_snmp.c
+++ b/src/zabbix_server/poller/checks_snmp.c
@@ -1221,7 +1221,7 @@ static void zbx_snmp_translate(char *oid_translated, const char *oid, size_t max
}
zbx_mib_norm_t;
-#define LEN_STR(x) sizeof(x) - 1, x
+#define LEN_STR(x) ZBX_CONST_STRLEN(x), x
static zbx_mib_norm_t mibs[] =
{
/* the most popular items first */
diff --git a/src/zabbix_server/server.c b/src/zabbix_server/server.c
index 8ea0d01380a..53e031c01b1 100644
--- a/src/zabbix_server/server.c
+++ b/src/zabbix_server/server.c
@@ -614,7 +614,6 @@ int main(int argc, char **argv)
{
ZBX_TASK_EX t = {ZBX_TASK_START};
char ch = '\0';
- int offset;
#if defined(PS_OVERWRITE_ARGV) || defined(PS_PSTAT_ARGV)
argv = setproctitle_save_env(argc, argv);
@@ -635,18 +634,20 @@ int main(int argc, char **argv)
t.flags = ZBX_RTC_MAKE_MESSAGE(ZBX_RTC_CONFIG_CACHE_RELOAD, 0, 0);
}
else if (0 == strncmp(zbx_optarg, ZBX_LOG_LEVEL_INCREASE,
- offset = strlen(ZBX_LOG_LEVEL_INCREASE)))
+ ZBX_CONST_STRLEN(ZBX_LOG_LEVEL_INCREASE)))
{
- if (SUCCEED != get_log_level_message(zbx_optarg + offset,
+ if (SUCCEED != get_log_level_message(
+ zbx_optarg + ZBX_CONST_STRLEN(ZBX_LOG_LEVEL_INCREASE),
ZBX_RTC_LOG_LEVEL_INCREASE, &t.flags))
{
exit(EXIT_FAILURE);
}
}
else if (0 == strncmp(zbx_optarg, ZBX_LOG_LEVEL_DECREASE,
- offset = strlen(ZBX_LOG_LEVEL_DECREASE)))
+ ZBX_CONST_STRLEN(ZBX_LOG_LEVEL_DECREASE)))
{
- if (SUCCEED != get_log_level_message(zbx_optarg + offset,
+ if (SUCCEED != get_log_level_message(
+ zbx_optarg + ZBX_CONST_STRLEN(ZBX_LOG_LEVEL_DECREASE),
ZBX_RTC_LOG_LEVEL_DECREASE, &t.flags))
{
exit(EXIT_FAILURE);