mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2025-02-20 11:43:27 +08:00
parent
986d36c028
commit
3a914f2d27
@ -12,12 +12,10 @@ bool ffNetifGetDefaultRouteImpl(char iface[IF_NAMESIZE + 1], uint32_t* ifIndex)
|
|||||||
FILE* FF_AUTO_CLOSE_FILE netRoute = fopen("/proc/net/route", "r");
|
FILE* FF_AUTO_CLOSE_FILE netRoute = fopen("/proc/net/route", "r");
|
||||||
if (!netRoute) return false;
|
if (!netRoute) return false;
|
||||||
|
|
||||||
// skip first line
|
// skip first line #1336
|
||||||
flockfile(netRoute);
|
fseek(netRoute, 128, SEEK_SET);
|
||||||
while (getc_unlocked(netRoute) != '\n');
|
|
||||||
funlockfile(netRoute);
|
|
||||||
unsigned long long destination; //, gateway, flags, refCount, use, metric, mask, mtu,
|
|
||||||
|
|
||||||
|
unsigned long long destination; //, gateway, flags, refCount, use, metric, mask, mtu,
|
||||||
while (fscanf(netRoute, "%" FF_STR(IF_NAMESIZE) "s%llx%*[^\n]", iface, &destination) == 2)
|
while (fscanf(netRoute, "%" FF_STR(IF_NAMESIZE) "s%llx%*[^\n]", iface, &destination) == 2)
|
||||||
{
|
{
|
||||||
if (destination != 0) continue;
|
if (destination != 0) continue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user