summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/irmd/main.c8
-rw-r--r--src/irmd/registry.c2
-rw-r--r--src/tools/oping/oping_client.c23
3 files changed, 19 insertions, 14 deletions
diff --git a/src/irmd/main.c b/src/irmd/main.c
index f2a6733d..0c1cd25d 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -657,10 +657,10 @@ static int ap_reg(char * name,
LOG_ERR("Could not register %s in DIF %s.",
name, e->dif_name);
} else {
- if(registry_add_name_to_dif(&irmd->registry,
- name,
- e->dif_name,
- e->type) < 0)
+ if (registry_add_name_to_dif(&irmd->registry,
+ name,
+ e->dif_name,
+ e->type) < 0)
LOG_WARN("Registered unbound name %s. "
"Registry may be inconsistent",
name);
diff --git a/src/irmd/registry.c b/src/irmd/registry.c
index a1d1238d..fc7213ab 100644
--- a/src/irmd/registry.c
+++ b/src/irmd/registry.c
@@ -210,7 +210,7 @@ static struct reg_entry * reg_entry_create()
}
static struct reg_entry * reg_entry_init(struct reg_entry * e,
- char * name)
+ char * name)
{
if (e == NULL || name == NULL)
return NULL;
diff --git a/src/tools/oping/oping_client.c b/src/tools/oping/oping_client.c
index 23a57549..7693ce41 100644
--- a/src/tools/oping/oping_client.c
+++ b/src/tools/oping/oping_client.c
@@ -212,16 +212,21 @@ int client_main()
printf("--- %s ping statistics ---\n", client.s_apn);
printf("%d SDU's transmitted, ", client.sent);
printf("%d received, ", client.rcvd);
- printf("%d%% packet loss, ", 100 - ((100 * client.rcvd) / client.sent));
+ printf("%d%% packet loss, ", client.sent == 0 ? 0 :
+ 100 - ((100 * client.rcvd) / client.sent));
printf("time: %.3f ms\n", ts_diff_us(&tic, &toc) / 1000.0);
- printf("rtt min/avg/max/mdev = %.3f/%.3f/%.3f/",
- client.rtt_min,
- client.rtt_avg,
- client.rtt_max);
- client.rcvd > 1 ?
- printf("%.3f ms\n",
- sqrt(client.rtt_m2 / (float) (client.rcvd - 1))) :
- printf("Nan ms\n");
+
+ if (client.rcvd > 0) {
+ printf("rtt min/avg/max/mdev = %.3f/%.3f/%.3f/",
+ client.rtt_min,
+ client.rtt_avg,
+ client.rtt_max);
+ if (client.rcvd > 1)
+ printf("%.3f ms\n",
+ sqrt(client.rtt_m2 / (float) (client.rcvd - 1)));
+ else
+ printf("NaN ms\n");
+ }
pthread_mutex_lock(&client.lock);
free(client.times);