From: Arran Cudbard-Bell Date: Mon, 28 Jan 2019 08:26:28 +0000 (+0700) Subject: Don't emit double newline where output ends on a multiple of 16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8390224bebfae200897af24e7fa6bdb0b1eceabb;p=thirdparty%2Ffreeradius-server.git Don't emit double newline where output ends on a multiple of 16 --- diff --git a/src/lib/util/proto.c b/src/lib/util/proto.c index 9a05aabc417..37028b41b76 100644 --- a/src/lib/util/proto.c +++ b/src/lib/util/proto.c @@ -58,7 +58,7 @@ void fr_proto_print_hex_data(char const *file, int line, char const *msg, uint8_ if ((i & 0x0f) == 0) fprintf(fr_log_fp, "hex: %s%.*s: %04x: ", prefix, (int)(proto_log_indent - len), spaces, (unsigned int) i); fprintf(fr_log_fp, "%02x ", data[i]); - if ((i & 0x0f) == 0x0f) fprintf(fr_log_fp, "\n"); + if (((i & 0x0f) == 0x0f) && ((i + 1) < data_len)) fprintf(fr_log_fp, "\n"); } if ((data_len == 0x0f) || ((data_len & 0x0f) != 0x0f)) fprintf(fr_log_fp, "\n"); fflush(fr_log_fp); @@ -86,7 +86,8 @@ void fr_proto_tlv_stack_print(char const *file, int line, char const *func, fr_d fr_dict_vendor_num_by_da(tlv_stack[i]), fr_dict_vendor_num_by_da(tlv_stack[i]), tlv_stack[i]->attr, tlv_stack[i]->attr); } - fprintf(fr_log_fp, "\n"); + fprintf(fr_log_fp, "stk: %s%.*s:\n", + prefix, (int)(proto_log_indent - len), spaces); fflush(fr_log_fp); }