diff --git a/src/print_battery_info.c b/src/print_battery_info.c index 7465d171..cd97b7f1 100644 --- a/src/print_battery_info.c +++ b/src/print_battery_info.c @@ -275,10 +275,10 @@ static bool slurp_battery_info(battery_info_ctx_t *ctx, struct battery_info *bat batt_info->status = CS_DISCHARGING; #elif defined(__OpenBSD__) /* - * We're using apm(4) here, which is the interface to acpi(4) on amd64/i386 and - * the generic interface on macppc/sparc64/zaurus. Machines that have ACPI - * battery sensors gain some extra information. - */ + * We're using apm(4) here, which is the interface to acpi(4) on amd64/i386 and + * the generic interface on macppc/sparc64/zaurus. Machines that have ACPI + * battery sensors gain some extra information. + */ struct apm_power_info apm_info; struct sensordev sensordev; struct sensor sensor; diff --git a/src/print_disk_info.c b/src/print_disk_info.c index 8be8deef..d5293434 100644 --- a/src/print_disk_info.c +++ b/src/print_disk_info.c @@ -135,7 +135,7 @@ void print_disk_info(disk_info_ctx_t *ctx) { #if defined(__DragonFly__) || defined(__APPLE__) struct statfs buf; - if (statfs(path, &buf) == -1) + if (statfs(ctx->path, &buf) == -1) return; mounted = true; diff --git a/src/print_eth_info.c b/src/print_eth_info.c index 9e2e22fe..ad738364 100644 --- a/src/print_eth_info.c +++ b/src/print_eth_info.c @@ -106,9 +106,9 @@ static int print_eth_speed(char *outwalk, const char *interface) { for (desc = ifm_subtype_descriptions; desc->ifmt_string != NULL; desc++) { /* - * Skip these non-informative values and go right ahead to the - * actual speeds. - */ + * Skip these non-informative values and go right ahead to the + * actual speeds. + */ if (BEGINS_WITH(desc->ifmt_string, "autoselect") || BEGINS_WITH(desc->ifmt_string, "auto")) continue; @@ -157,7 +157,7 @@ void print_eth_info(eth_info_ctx_t *ctx) { /* * Removing '%' and following characters from IPv6 since the interface identifier is redundant, * as the output already includes the interface name. - */ + */ if (ipv6_address != NULL) { char *prct_ptr = strstr(ipv6_address, "%"); if (prct_ptr != NULL) { diff --git a/src/print_ip_addr.c b/src/print_ip_addr.c index 463412f5..f7795de5 100644 --- a/src/print_ip_addr.c +++ b/src/print_ip_addr.c @@ -29,10 +29,13 @@ static char *strip_optional_label(const char *ifa_name) { char *copy = sstrdup(ifa_name); - char *ptr = strchr(copy, ':'); + char *ptr1 = strchr(copy, ':'); + char *ptr2 = strchr(copy, '@'); - if (ptr) { - *ptr = '\0'; + if (ptr1 && (ptr1 < ptr2)) { + *ptr1 = '\0'; + } else if (ptr2) { + *ptr2 = '\0'; } return copy; diff --git a/src/print_wireless_info.c b/src/print_wireless_info.c index 22bc8fa0..1ad83150 100644 --- a/src/print_wireless_info.c +++ b/src/print_wireless_info.c @@ -402,9 +402,9 @@ static int get_wireless_info(const char *interface, wireless_info_t *info) { close(s); if (na.i_len >= sizeof(u.req)) { /* - * Just use the first BSSID returned even if there are - * multiple APs sharing the same BSSID. - */ + * Just use the first BSSID returned even if there are + * multiple APs sharing the same BSSID. + */ info->signal_level = u.req.info[0].isi_rssi / 2 + u.req.info[0].isi_noise; info->flags |= WIRELESS_INFO_FLAG_HAS_SIGNAL; @@ -523,7 +523,7 @@ void print_wireless_info(wireless_info_ctx_t *ctx) { /* * Removing '%' and following characters from IPv6 since the interface identifier is redundant, * as the output already includes the interface name. - */ + */ if (ipv6_address != NULL) { char *prct_ptr = strstr(ipv6_address, "%"); if (prct_ptr != NULL) {