Bugfix
This commit is contained in:
@@ -103,9 +103,21 @@ static int parse_hw_addr(std::string str, std::vector<char> &hw_addr) {
|
||||
std::string find_mac() {
|
||||
std::ifstream iface_stream("/sys/class/net/eth0/address");
|
||||
if (!iface_stream) {
|
||||
printf("No eth0 \n");
|
||||
iface_stream.open("/sys/class/net/wlan0/address");
|
||||
}
|
||||
if (!iface_stream) return "";
|
||||
if (!iface_stream) {
|
||||
printf("No wlan0 \n");
|
||||
iface_stream.open("/sys/class/net/enp0s25/address");
|
||||
}
|
||||
if (!iface_stream) {
|
||||
printf("No enp0s25 \n");
|
||||
iface_stream.open("/sys/class/net/wlp2s0/address");
|
||||
}
|
||||
if (!iface_stream) {
|
||||
printf("No wlp2s0");
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string mac_address;
|
||||
iface_stream >> mac_address;
|
||||
|
||||
Reference in New Issue
Block a user