--- lbbs/src/net_server.c 2025/12/17 04:22:40 1.107 +++ lbbs/src/net_server.c 2025/12/17 07:42:32 1.108 @@ -530,7 +530,6 @@ int net_server(const char *hostaddr, in_ int nfds; int notify_child_exit = 0; time_t tm_notify_child_exit = time(NULL); - int i, j; pid_t pid; int ssh_key_valid = 0; int ssh_log_level = SSH_LOG_NOLOG; @@ -595,7 +594,7 @@ int net_server(const char *hostaddr, in_ #endif // Server socket - for (i = 0; i < 2; i++) + for (int i = 0; i < 2; i++) { socket_server[i] = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); @@ -713,8 +712,8 @@ int net_server(const char *hostaddr, in_ if (pid != section_list_loader_pid) { - j = 0; - ret = hash_dict_get(hash_dict_pid_sockaddr, (uint64_t)pid, (int64_t *)&j); + int64_t j = 0; + ret = hash_dict_get(hash_dict_pid_sockaddr, (uint64_t)pid, &j); if (ret < 0) { log_error("hash_dict_get(hash_dict_pid_sockaddr, %d) error\n", pid); @@ -724,13 +723,13 @@ int net_server(const char *hostaddr, in_ ret = hash_dict_inc(hash_dict_sockaddr_count, (in_addr_t)j, -1); if (ret <= 0) { - log_error("hash_dict_inc(hash_dict_sockaddr_count, %d, -1) error: %d\n", (in_addr_t)j, ret); + log_error("hash_dict_inc(hash_dict_sockaddr_count, %lu, -1) error: %d\n", (in_addr_t)j, ret); } ret = hash_dict_del(hash_dict_pid_sockaddr, (uint64_t)pid); if (ret < 0) { - log_error("hash_dict_del(hash_dict_pid_sockaddr, %d) error\n", pid); + log_error("hash_dict_del(hash_dict_pid_sockaddr, %lu) error\n", (uint64_t)pid); } } } @@ -939,8 +938,8 @@ int net_server(const char *hostaddr, in_ if (SYS_child_process_count - 1 < BBS_max_client) { - j = 0; - ret = hash_dict_get(hash_dict_sockaddr_count, (uint64_t)sin.sin_addr.s_addr, (int64_t *)&j); + int64_t j = 0; + ret = hash_dict_get(hash_dict_sockaddr_count, sin.sin_addr.s_addr, &j); if (ret < 0) { log_error("hash_dict_get(hash_dict_sockaddr_count, %s) error\n", hostaddr_client); @@ -957,7 +956,7 @@ int net_server(const char *hostaddr, in_ ret = hash_dict_set(hash_dict_pid_sockaddr, (uint64_t)pid, sin.sin_addr.s_addr); if (ret < 0) { - log_error("hash_dict_set(hash_dict_pid_sockaddr, %d, %s) error\n", pid, hostaddr_client); + log_error("hash_dict_set(hash_dict_pid_sockaddr, %lu, %s) error\n", (uint64_t)pid, hostaddr_client); } if (j == 0) @@ -1014,7 +1013,7 @@ int net_server(const char *hostaddr, in_ } #endif - for (i = 0; i < 2; i++) + for (int i = 0; i < 2; i++) { if (close(socket_server[i]) == -1) {