mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2025-02-20 11:43:27 +08:00
LocalIP (Linux): fix network prefix detection when the value is greater than 24
This commit is contained in:
parent
77431671bb
commit
de6b1f9542
@ -84,7 +84,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
|
||||
inet_ntop(AF_INET, &ipv4->sin_addr, addressBuffer, INET_ADDRSTRLEN);
|
||||
|
||||
struct sockaddr_in* netmask = (struct sockaddr_in*) ifa->ifa_netmask;
|
||||
int cidr = __builtin_popcount(inet_netof(netmask->sin_addr));
|
||||
int cidr = __builtin_popcount(netmask->sin_addr.s_addr);
|
||||
if (cidr != 0)
|
||||
{
|
||||
size_t len = strlen(addressBuffer);
|
||||
|
Loading…
x
Reference in New Issue
Block a user