Source
/*
** Zabbix
** Copyright (C) 2001-2023 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
static int parse_log_level_options(const char *opt, size_t len, unsigned int *scope, unsigned int *data)
{
unsigned short num = 0;
const char *rtc_options;
rtc_options = opt + len;
if ('\0' == *rtc_options)
{
*scope = ZBX_RTC_LOG_SCOPE_FLAG | ZBX_RTC_LOG_SCOPE_PID;
*data = 0;
}
else if ('=' != *rtc_options)
{
zbx_error("invalid runtime control option: %s", opt);
return FAIL;
}
else if (0 != isdigit(*(++rtc_options)))
{
/* convert PID */
if (FAIL == zbx_is_ushort(rtc_options, &num) || 0 == num)
{
zbx_error("invalid log level control target: invalid or unsupported process identifier");
return FAIL;
}
*scope = ZBX_RTC_LOG_SCOPE_FLAG | ZBX_RTC_LOG_SCOPE_PID;
*data = num;
}
else
{
char *proc_name = NULL, *proc_num;
int proc_type;
if ('\0' == *rtc_options)
{
zbx_error("invalid log level control target: unspecified process identifier or type");
return FAIL;