mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-21 23:45:49 +08:00
Fix Linux compile issue.
This commit is contained in:
@@ -69,19 +69,28 @@ void CNetworkInfo::getNetworkInterface(unsigned char* info)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char* dflt = NULL;
|
||||||
|
|
||||||
char line[100U];
|
char line[100U];
|
||||||
while (::fgets(line, 100U, fp)) {
|
while (::fgets(line, 100U, fp)) {
|
||||||
char* dflt = strtok(line , " \t");
|
char* p1 = strtok(line , " \t");
|
||||||
char* p = strtok(NULL , " \t");
|
char* p2 = strtok(NULL , " \t");
|
||||||
|
|
||||||
if (dflt != NULL && p != NULL) {
|
if (p1 != NULL && p2 != NULL) {
|
||||||
if (::strcmp(p , "00000000") == 0)
|
if (::strcmp(p2, "00000000") == 0) {
|
||||||
|
dflt = p1;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
::fclose(fp);
|
::fclose(fp);
|
||||||
|
|
||||||
|
if (dflt == NULL) {
|
||||||
|
LogError("Unable to find the default route");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
char interfacelist[IFLISTSIZ][50+INET6_ADDRSTRLEN];
|
char interfacelist[IFLISTSIZ][50+INET6_ADDRSTRLEN];
|
||||||
for (unsigned int n = 0U; n < IFLISTSIZ; n++)
|
for (unsigned int n = 0U; n < IFLISTSIZ; n++)
|
||||||
interfacelist[n][0] = 0;
|
interfacelist[n][0] = 0;
|
||||||
@@ -133,7 +142,7 @@ void CNetworkInfo::getNetworkInterface(unsigned char* info)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LogInfo(" IP to show: %s", info );
|
LogInfo(" IP to show: %s", info);
|
||||||
#else
|
#else
|
||||||
PMIB_IPFORWARDTABLE pIpForwardTable = (MIB_IPFORWARDTABLE *)::malloc(sizeof(MIB_IPFORWARDTABLE));
|
PMIB_IPFORWARDTABLE pIpForwardTable = (MIB_IPFORWARDTABLE *)::malloc(sizeof(MIB_IPFORWARDTABLE));
|
||||||
if (pIpForwardTable == NULL) {
|
if (pIpForwardTable == NULL) {
|
||||||
|
|||||||
Reference in New Issue
Block a user