Fix clang-tidy warning
This commit is contained in:
@@ -187,6 +187,7 @@ int dns_rr_add_end(struct dns_packet *packet, int type, dns_type_t rtype, int le
|
||||
case DNS_RRS_OPT:
|
||||
count = &packet->optcount;
|
||||
start = &packet->optional;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
break;
|
||||
@@ -840,7 +841,7 @@ static int _dns_decode_domain(struct dns_context *context, char *output, int siz
|
||||
{
|
||||
int output_len = 0;
|
||||
int copy_len = 0;
|
||||
int len = *(context->ptr);
|
||||
int len = 0;
|
||||
unsigned char *ptr = context->ptr;
|
||||
int is_compressed = 0;
|
||||
int ptr_jump = 0;
|
||||
@@ -1446,6 +1447,10 @@ static int _dns_decode_opt(struct dns_context *context, dns_rr_type type, unsign
|
||||
}
|
||||
|
||||
ret = dns_add_OPT_ECS(packet, &ecs);
|
||||
if (ret != 0 ) {
|
||||
tlog(TLOG_ERROR, "add ecs failed.");
|
||||
return -1;
|
||||
}
|
||||
} break;
|
||||
default:
|
||||
context->ptr += opt_len;
|
||||
|
||||
@@ -1529,7 +1529,7 @@ static int _dns_client_process_tcp(struct dns_server_info *server_info, struct e
|
||||
{
|
||||
int len;
|
||||
int ret = -1;
|
||||
unsigned char *inpacket_data = server_info->recv_buff.data;
|
||||
unsigned char *inpacket_data = NULL;
|
||||
|
||||
if (event->events & EPOLLIN) {
|
||||
/* receive from tcp */
|
||||
|
||||
@@ -338,7 +338,7 @@ errout:
|
||||
}
|
||||
|
||||
tlog(TLOG_ERROR, "add doamin %s rule failed", domain);
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int config_domain_rule_flag_set(char *domain, unsigned int flag)
|
||||
|
||||
@@ -459,8 +459,8 @@ static int _dns_server_reply_SOA(int rcode, struct dns_request *request, struct
|
||||
|
||||
soa = &request->soa;
|
||||
|
||||
strcpy(soa->mname, "a.gtld-servers.net");
|
||||
strcpy(soa->rname, "nstld.verisign-grs.com");
|
||||
strncpy(soa->mname, "a.gtld-servers.net", DNS_MAX_CNAME_LEN);
|
||||
strncpy(soa->rname, "nstld.verisign-grs.com", DNS_MAX_CNAME_LEN);
|
||||
soa->serial = 1800;
|
||||
soa->refresh = 1800;
|
||||
soa->retry = 900;
|
||||
@@ -1866,12 +1866,14 @@ static int _dns_server_process_tcp(struct dns_server_conn *dnsserver, struct epo
|
||||
if (event->events & EPOLLIN) {
|
||||
if (_dns_server_tcp_process_requests(dnsserver) != 0) {
|
||||
_dns_server_client_close(dnsserver);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (event->events & EPOLLOUT) {
|
||||
if (_dns_server_tcp_send(dnsserver) != 0) {
|
||||
_dns_server_client_close(dnsserver);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1042,7 +1042,7 @@ static void *_tlog_work(void *arg)
|
||||
|
||||
if ((log == loop_log || log == NULL) && tlog.run) {
|
||||
/* if buffer is empty, wait */
|
||||
if ((log == NULL) || (log && log->end == log->start && log->ext_end <= 0)) {
|
||||
if ((log == NULL) || (log && (log->end == log->start) && (log->ext_end <= 0))) {
|
||||
clock_gettime(CLOCK_REALTIME, &tm);
|
||||
tm.tv_sec += 2;
|
||||
tlog.is_wait = 1;
|
||||
@@ -1064,7 +1064,7 @@ static void *_tlog_work(void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
if (log && log->end == log->start && log->ext_end <= 0) {
|
||||
if (log && (log->end == log->start) && (log->ext_end <= 0)) {
|
||||
if (log->is_exit) {
|
||||
if (_tlog_close(log, 0) == 0) {
|
||||
log = NULL;
|
||||
|
||||
Reference in New Issue
Block a user