mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:14:37 +02:00
Netif (Linux): don't use fseek
Turns out that `fseek` generates two extra syscalls, which causes unnecessary overhead.
This commit is contained in:
@@ -12,8 +12,8 @@ bool ffNetifGetDefaultRouteImpl(char iface[IF_NAMESIZE + 1], uint32_t* ifIndex)
|
||||
FILE* FF_AUTO_CLOSE_FILE netRoute = fopen("/proc/net/route", "r");
|
||||
if (!netRoute) return false;
|
||||
|
||||
// skip first line #1336
|
||||
fseek(netRoute, 128, SEEK_SET);
|
||||
// skip first line
|
||||
fscanf(netRoute, "%*[^\n]\n");
|
||||
|
||||
unsigned long long destination; //, gateway, flags, refCount, use, metric, mask, mtu,
|
||||
while (fscanf(netRoute, "%" FF_STR(IF_NAMESIZE) "s%llx%*[^\n]", iface, &destination) == 2)
|
||||
|
||||
Reference in New Issue
Block a user