From: Sami Kerola Date: Sun, 28 Aug 2016 23:55:24 +0000 (+0100) Subject: crash fix: make --xml not to dump core X-Git-Tag: v0.88~26^2~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F146%2Fhead;p=thirdparty%2Fmtr.git crash fix: make --xml not to dump core This also makes --report option to print values rather than %5N. And in same go remove a floating point exception. Crash these issues were introduced in caad4c42fb8ef0d830fd37608a96702d6774f93f --- diff --git a/mtr.c b/mtr.c index 437e1e4..17ae265 100644 --- a/mtr.c +++ b/mtr.c @@ -70,8 +70,8 @@ struct fields data_fields[MAXFLD] = { {' ', ": Space between fields", " ", " ", 1, &net_drop }, {'L', "L: Loss Ratio", "Loss%", " %4.1f%%", 6, &net_loss }, {'D', "D: Dropped Packets", "Drop", " %4d", 5, &net_drop }, - {'R', "R: Received Packets", "Rcv", " %5N", 6, &net_returned}, - {'S', "S: Sent Packets", "Snt", " %5N", 6, &net_xmit }, + {'R', "R: Received Packets", "Rcv", " %5d", 6, &net_returned}, + {'S', "S: Sent Packets", "Snt", " %5d", 6, &net_xmit }, {'N', "N: Newest RTT(ms)", "Last", " %5.1f", 6, &net_last }, {'B', "B: Min/Best RTT(ms)", "Best", " %5.1f", 6, &net_best }, {'A', "A: Average RTT(ms)", "Avg", " %5.1f", 6, &net_avg }, diff --git a/report.c b/report.c index 61b09e4..86fdab0 100644 --- a/report.c +++ b/report.c @@ -97,7 +97,7 @@ extern void report_close(struct mtr_ctl *ctl) #ifdef HAVE_IPINFO int len_tmp = len_hosts; - if (ctl->ipinfo_no >= 0) { + if (ctl->ipinfo_no >= 0 && ctl->iiwidth_len) { ctl->ipinfo_no %= ctl->iiwidth_len; if (ctl->reportwide) { len_hosts++; // space