Fix format_mac_address function in parse_mac.cc

Apparently the stream manipulator `std::setw` applies only to the next string written to the stream. Hence the function `format_mac_address` in parse_mac.cc only formatted the first pair of hexadecimal digits correctly. This went unnoticed until now because it only makes a difference for numbers below 0x10.
This commit is contained in:
Anton Ottosson
2021-08-03 17:35:32 +02:00
parent 6b5a8c1ddc
commit ef5fd6c595
+1 -1
View File
@@ -419,7 +419,7 @@ public:
str << std::setfill('0') << std::hex << std::setw(2) << (int)addr[0]; str << std::setfill('0') << std::hex << std::setw(2) << (int)addr[0];
for (int i = 1; i < 6; i++) { for (int i = 1; i < 6; i++) {
str << ":" << (int)addr[i]; str << ":" << std::setw(2) << (int)addr[i];
} }
return str.str(); return str.str();