fix: windows compilation error

This commit is contained in:
slzhou 2023-08-31 15:44:42 +08:00
parent 189c5cf137
commit 16e3541d4a
1 changed files with 3 additions and 4 deletions

View File

@ -13,8 +13,7 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <uv.h>
#include <arpa/inet.h>
#include <regex.h> #include <regex.h>
#include "parAst.h" #include "parAst.h"
@ -1661,7 +1660,7 @@ static int32_t getIpV4RangeFromWhitelistItem(char* ipRange, SIpV4Range* pIpRange
if (slash) { if (slash) {
*slash = '\0'; *slash = '\0';
struct in_addr addr; struct in_addr addr;
if (inet_pton(AF_INET, ipCopy, &addr) == 1) { if (uv_inet_pton(AF_INET, ipCopy, &addr) == 0) {
int prefix = atoi(slash + 1); int prefix = atoi(slash + 1);
if (prefix < 0 || prefix > 32) { if (prefix < 0 || prefix > 32) {
code = TSDB_CODE_PAR_INVALID_IP_RANGE; code = TSDB_CODE_PAR_INVALID_IP_RANGE;
@ -1677,7 +1676,7 @@ static int32_t getIpV4RangeFromWhitelistItem(char* ipRange, SIpV4Range* pIpRange
} }
} else { } else {
struct in_addr addr; struct in_addr addr;
if (inet_pton(AF_INET, ipCopy, &addr) == 1) { if (uv_inet_pton(AF_INET, ipCopy, &addr) == 0) {
pIpRange->ip = addr.s_addr; pIpRange->ip = addr.s_addr;
pIpRange->mask = 0xFFFFFFFF; pIpRange->mask = 0xFFFFFFFF;
code = TSDB_CODE_SUCCESS; code = TSDB_CODE_SUCCESS;