修改日志文件的日期错误的问题。删除功能重复的无效代码。
This commit is contained in:
@@ -154,7 +154,7 @@ struct log_file_list * create_log_file_node(char *log_file)
|
||||
curtime = time(NULL);
|
||||
localtime_r(&curtime, &date);
|
||||
n = snprintf(node->real_log_file, sizeof(node->real_log_file), "%s.%d-%d-%d",
|
||||
node->log_file_pre, date.tm_year + 1900, date.tm_mon, date.tm_mday);
|
||||
node->log_file_pre, date.tm_year + 1900, date.tm_mon + 1, date.tm_mday);
|
||||
if(n >= sizeof(node->real_log_file)){
|
||||
goto error;
|
||||
}
|
||||
@@ -221,7 +221,7 @@ int check_reopen_log_file(struct log_file_list *node)
|
||||
|
||||
node->create_date = date;
|
||||
n = snprintf(node->real_log_file, sizeof(node->real_log_file), "%s.%d-%d-%d", node->log_file_pre,
|
||||
node->create_date.tm_year, node->create_date.tm_mon, node->create_date.tm_mday);
|
||||
node->create_date.tm_year + 1900, node->create_date.tm_mon + 1, node->create_date.tm_mday);
|
||||
if(n >= sizeof(node->real_log_file)){
|
||||
return CONSUMER_ERROR;
|
||||
}
|
||||
@@ -314,18 +314,6 @@ int producer_pid_is_cared(int producer_pid)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int check_care_pid_repeat(int pid)
|
||||
{
|
||||
struct care_pid_list *tmp;
|
||||
struct care_pid_list *n;
|
||||
list_for_each_entry_safe(tmp, n, &g_care_pid_list.list, list){
|
||||
if(tmp->pid == pid){
|
||||
return CONSUMER_ERROR;
|
||||
}
|
||||
}
|
||||
return CONSUMER_SUCCESS;
|
||||
}
|
||||
struct care_pid_list *create_care_pid_node(int pid)
|
||||
{
|
||||
struct care_pid_list *node;
|
||||
@@ -339,7 +327,7 @@ struct care_pid_list *create_care_pid_node(int pid)
|
||||
}
|
||||
int add_care_pid_node(struct care_pid_list *node, int pid)
|
||||
{
|
||||
if(check_care_pid_repeat(pid) == CONSUMER_SUCCESS){
|
||||
if(!producer_pid_is_cared(pid)){
|
||||
list_add(&node->list, &g_care_pid_list.list);
|
||||
}else{
|
||||
free(node);
|
||||
@@ -490,11 +478,9 @@ int get_cur_tty_fd()
|
||||
{
|
||||
FILE *fp = NULL;
|
||||
char cur_tty_name[DEFAUT_BUF_SIZE] = {0};
|
||||
char command[DEFAUT_BUF_SIZE] = {0};
|
||||
char *p = NULL;
|
||||
int cur_tty_fd = -1;
|
||||
snprintf(command, sizeof(command), "tty");
|
||||
fp = popen(command, "r");
|
||||
fp = popen("tty", "r");
|
||||
if(fp == NULL){
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user