MOD aaa-12 解决静态代码警告 SOL 修改人:zhangliang 检视人:zhangliang
This commit is contained in:
parent
59a8d288d7
commit
9af17eea00
|
@ -149,7 +149,6 @@ int log_level_to_str(const u8 level, char *str, u32 len)
|
||||||
|
|
||||||
int write_conf_content(FILE *fp, const u8 level, const char *filter_mod, void *arg)
|
int write_conf_content(FILE *fp, const u8 level, const char *filter_mod, void *arg)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
char line[MAX_LINE_SZ + 100] = {0};
|
char line[MAX_LINE_SZ + 100] = {0};
|
||||||
ULOG_DEBUG(g_log, "filter module:%s\n", filter_mod);
|
ULOG_DEBUG(g_log, "filter module:%s\n", filter_mod);
|
||||||
|
@ -243,7 +242,7 @@ void rpc_conf_proc(rpc_conn *conn, pointer input, int input_len, int need_len, r
|
||||||
|
|
||||||
if (input_len < need_len) {
|
if (input_len < need_len) {
|
||||||
if (snprintf(str_err, sizeof(str_err),
|
if (snprintf(str_err, sizeof(str_err),
|
||||||
"The input paramter of rpc log is needed length of %u, but the actual length is %u",
|
"The input paramter of rpc log is needed length of %d, but the actual length is %d",
|
||||||
need_len, input_len) < 0) {
|
need_len, input_len) < 0) {
|
||||||
strncpy(str_err, "Setting error message is failure", sizeof(str_err));
|
strncpy(str_err, "Setting error message is failure", sizeof(str_err));
|
||||||
ULOG_ERR(g_log, str_err);
|
ULOG_ERR(g_log, str_err);
|
||||||
|
@ -395,10 +394,8 @@ ret_code get_log_file_conf(const char *key_str, char *value_str, int value_len)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t n, n1, n2;
|
ssize_t n;
|
||||||
char *line = NULL;
|
char *line = NULL;
|
||||||
char tmp_key[MAX_LINE_SZ], tmp_value[MAX_LINE_SZ];
|
|
||||||
|
|
||||||
while ((getline(&line, &n, g_conf_fp)) != -1)
|
while ((getline(&line, &n, g_conf_fp)) != -1)
|
||||||
{
|
{
|
||||||
if (strstr(line, key_str) == NULL )
|
if (strstr(line, key_str) == NULL )
|
||||||
|
|
|
@ -138,7 +138,6 @@ ret_code console_initial()
|
||||||
char *pos = NULL;
|
char *pos = NULL;
|
||||||
char *pos2 = NULL;
|
char *pos2 = NULL;
|
||||||
char ttyfile_str[128] = "";
|
char ttyfile_str[128] = "";
|
||||||
size_t str_len = 0;
|
|
||||||
|
|
||||||
fp = fopen(CM_LOG_CONF_CONSOLE_FILE, "r");
|
fp = fopen(CM_LOG_CONF_CONSOLE_FILE, "r");
|
||||||
if (NULL == fp) {
|
if (NULL == fp) {
|
||||||
|
@ -155,6 +154,7 @@ ret_code console_initial()
|
||||||
|
|
||||||
ssize_t n;
|
ssize_t n;
|
||||||
char *line = NULL;
|
char *line = NULL;
|
||||||
|
int str_len;
|
||||||
while ((getline(&line, &n, fp)) != -1)
|
while ((getline(&line, &n, fp)) != -1)
|
||||||
{
|
{
|
||||||
pos = strstr(line, "/");
|
pos = strstr(line, "/");
|
||||||
|
|
|
@ -74,7 +74,6 @@ static ret_code write_pty_conf()
|
||||||
static void *pty_monitor_thread(void *arg)
|
static void *pty_monitor_thread(void *arg)
|
||||||
{
|
{
|
||||||
struct epoll_event events[MAX_EVENT_NUMBER];
|
struct epoll_event events[MAX_EVENT_NUMBER];
|
||||||
int ret;
|
|
||||||
ret_code ret_c;
|
ret_code ret_c;
|
||||||
char buf[MAX_LINE_SZ];
|
char buf[MAX_LINE_SZ];
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
|
@ -84,7 +83,7 @@ static void *pty_monitor_thread(void *arg)
|
||||||
ULOG_DEBUG(g_log, "Monitor pty is begining");
|
ULOG_DEBUG(g_log, "Monitor pty is begining");
|
||||||
while (1) {
|
while (1) {
|
||||||
//ULOG_DEBUG(g_log, "Epoll is waiting");
|
//ULOG_DEBUG(g_log, "Epoll is waiting");
|
||||||
ret = epoll_wait(g_epoll_fd, events, MAX_EVENT_NUMBER, 1000);
|
int ret = epoll_wait(g_epoll_fd, events, MAX_EVENT_NUMBER, 1000);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
if (errno == EBADF) {
|
if (errno == EBADF) {
|
||||||
ULOG_DEBUG(g_log, "Epoll has been shut or invalid");
|
ULOG_DEBUG(g_log, "Epoll has been shut or invalid");
|
||||||
|
@ -273,7 +272,7 @@ static int config_log_pty(const log_pty_t *conf)
|
||||||
/* off时,将log-sched配置文件中pty日志级别调成默认值info,即level=6 */
|
/* off时,将log-sched配置文件中pty日志级别调成默认值info,即level=6 */
|
||||||
if (0 == ret) {
|
if (0 == ret) {
|
||||||
memset(value_str, 0, sizeof(value_str));
|
memset(value_str, 0, sizeof(value_str));
|
||||||
sprintf(value_str, "%u", 6);
|
snprintf(value_str, sizeof(value_str), "%u", LOG_INFO);
|
||||||
if (write_log_file_conf(LOG_CONF_KEY_PTY_LEVEL_STR, value_str) != 0) {
|
if (write_log_file_conf(LOG_CONF_KEY_PTY_LEVEL_STR, value_str) != 0) {
|
||||||
ULOG_ERR(g_log, "Pty-level which is written is failure");
|
ULOG_ERR(g_log, "Pty-level which is written is failure");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -35,11 +35,11 @@ static op_func remote_funcs[] = {
|
||||||
|
|
||||||
static int match_remote_config(const char *line, const void *src)
|
static int match_remote_config(const char *line, const void *src)
|
||||||
{
|
{
|
||||||
char text_level[MAX_LINE_SZ], old_redirect[MAX_LINE_SZ];
|
char text_level[MAX_LINE_SZ + 1], old_redirect[MAX_LINE_SZ + 1];
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
ULOG_DEBUG(g_log, "The line:%s will be matched", line);
|
ULOG_DEBUG(g_log, "The line:%s will be matched", line);
|
||||||
n = sscanf(line, "%s"REDIRECT_SEPERATE"%s", text_level, old_redirect);
|
n = sscanf(line, "%1024s"REDIRECT_SEPERATE"%1024s", text_level, old_redirect);
|
||||||
if (n == 2) {
|
if (n == 2) {
|
||||||
// 匹配到
|
// 匹配到
|
||||||
// 是否相同配置判读
|
// 是否相同配置判读
|
||||||
|
@ -81,7 +81,6 @@ static int remote_conf_content(FILE *fp, const u8 level, const char *filter_mod,
|
||||||
|
|
||||||
|
|
||||||
ssize_t n, n1;
|
ssize_t n, n1;
|
||||||
char text_level[MAX_LINE_SZ], old_redirect[MAX_LINE_SZ];
|
|
||||||
while ((n = getline(&line, &n, bak_fp)) != -1) {
|
while ((n = getline(&line, &n, bak_fp)) != -1) {
|
||||||
int match = match_cb(line, arg);
|
int match = match_cb(line, arg);
|
||||||
if (match == -1) {
|
if (match == -1) {
|
||||||
|
@ -141,7 +140,7 @@ static int remote_conf_level_content(FILE *fp, const u8 level)
|
||||||
char text_level[MAX_LINE_SZ], old_redirect[MAX_LINE_SZ];
|
char text_level[MAX_LINE_SZ], old_redirect[MAX_LINE_SZ];
|
||||||
char rewrite_line[MAX_LINE_SZ];
|
char rewrite_line[MAX_LINE_SZ];
|
||||||
while ((n1 = getline(&line, &n, bak_fp)) != -1) {
|
while ((n1 = getline(&line, &n, bak_fp)) != -1) {
|
||||||
n3 = sscanf(line, "%s"REDIRECT_SEPERATE"%s", text_level, old_redirect);
|
n3 = sscanf(line, "%1024s"REDIRECT_SEPERATE"%1024s", text_level, old_redirect);
|
||||||
if (n3 == 2) {
|
if (n3 == 2) {
|
||||||
// 匹配到
|
// 匹配到
|
||||||
// 改变该行日志级别
|
// 改变该行日志级别
|
||||||
|
|
Loading…
Reference in New Issue