summaryrefslogtreecommitdiff
path: root/testcases/018-battery-capacity
diff options
context:
space:
mode:
authorOlivier Gayot <olivier.gayot@sigexec.com>2018-06-04 19:59:15 +0200
committerOlivier Gayot <olivier.gayot@sigexec.com>2018-06-11 22:06:57 +0200
commit451ff9be0b87946778250fdffcc62b04817b6394 (patch)
treee985b9f6be46aad5edb92138a64936070c44728b /testcases/018-battery-capacity
parent99a6fb5e49515accfb93dc6bc79b439d0a4f85ca (diff)
Fix shown IP address belonging to wrong interface
The following commit: 6a75ea9 Show IP address when address has a label introduced a way to show the IP address of an interface when a label is associated to the IP. When a label is associated to an IP, the structure returned by getifaddrs() has the label concatenated to the interface name in the .ifa_name field as in the following example: struct ifaddrs ifaddr = { .ifa_name = "eth0:mylabel", }; As a consequence, using a strict comparison between the interface name and the .ifa_name field yields a falsy result. However, checking if the .ifa_name starts with the interface name (e.g. eth0) does not work either because other network interfaces can have a name which starts with eth0. This commit solves the issue by stripping out the optional label from the .ifa_name field before making a strict comparison with the interface name. Fix #283 Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
Diffstat (limited to 'testcases/018-battery-capacity')
0 files changed, 0 insertions, 0 deletions