mirror of
https://github.com/sipeed/NanoKVM.git
synced 2026-09-11 00:22:56 -05:00
Merge pull request #363 from scpcom/kvm_system-fix-ip_address-empty-checks
support: kvm_system: fix 'const char' and 'std::nullptr_t' comparsion
This commit is contained in:
@@ -51,7 +51,7 @@ int get_ip_addr(ip_addr_t ip_type)
|
||||
switch (ip_type){
|
||||
case ETH_IP: // eth_addr
|
||||
if(strcmp(ip_address()["eth0"].c_str(), (char*)kvm_sys_state.eth_addr) != 0){
|
||||
if(*(ip_address()["eth0"].c_str()) == NULL){
|
||||
if(*(ip_address()["eth0"].c_str()) == 0){
|
||||
printf("can`t get ip addr\r\n");
|
||||
kvm_sys_state.eth_addr[0] = 0;
|
||||
return 0;
|
||||
@@ -66,7 +66,7 @@ int get_ip_addr(ip_addr_t ip_type)
|
||||
return 1;
|
||||
case WiFi_IP: // wifi_addr
|
||||
if(strcmp(ip_address()["wlan0"].c_str(), (char*)kvm_sys_state.wifi_addr) != 0){
|
||||
if(*(ip_address()["wlan0"].c_str()) == NULL){
|
||||
if(*(ip_address()["wlan0"].c_str()) == 0){
|
||||
printf("can`t get ip addr\r\n");
|
||||
kvm_sys_state.wifi_addr[0] = 0;
|
||||
return 0;
|
||||
@@ -80,7 +80,7 @@ int get_ip_addr(ip_addr_t ip_type)
|
||||
}
|
||||
return 1;
|
||||
case Tailscale_IP: // tail_addr
|
||||
if(*(ip_address()["tailscale0"].c_str()) == NULL){
|
||||
if(*(ip_address()["tailscale0"].c_str()) == 0){
|
||||
printf("can`t get ip addr\r\n");
|
||||
kvm_sys_state.tail_addr[0] = 0;
|
||||
return 0;
|
||||
@@ -93,7 +93,7 @@ int get_ip_addr(ip_addr_t ip_type)
|
||||
printf("\r\n");
|
||||
return 1;
|
||||
case RNDIS_IP: // rndis_addr
|
||||
if(*(ip_address()["usb0"].c_str()) == NULL){
|
||||
if(*(ip_address()["usb0"].c_str()) == 0){
|
||||
printf("can`t get ip addr\r\n");
|
||||
kvm_sys_state.rndis_addr[0] = 0;
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user