[PATCH 1/3] idiag: don't dump unset properties of idiag_msg
Thomas Graf
tgraf at suug.ch
Thu Nov 27 06:48:40 PST 2014
On 11/27/14 at 01:09pm, Thomas Haller wrote:
> Signed-off-by: Thomas Haller <thaller at redhat.com>
Acked-by: Thomas Graf <tgraf at suug.ch>
> ---
> lib/idiag/idiag_msg_obj.c | 46 ++++++++++++++++++++++++----------------------
> 1 file changed, 24 insertions(+), 22 deletions(-)
>
> diff --git a/lib/idiag/idiag_msg_obj.c b/lib/idiag/idiag_msg_obj.c
> index 8199536..6e4948e 100644
> --- a/lib/idiag/idiag_msg_obj.c
> +++ b/lib/idiag/idiag_msg_obj.c
> @@ -458,7 +458,7 @@ static void idiag_msg_dump_details(struct nl_object *a, struct nl_dump_params *p
>
> nl_dump(p, "tos: 0x%x\n", msg->idiag_tos);
> nl_dump(p, "traffic class: %d\n", msg->idiag_tclass);
> - nl_dump(p, "congestion algorithm: %s\n", msg->idiag_cong);
> + nl_dump(p, "congestion algorithm: %s\n", msg->idiag_cong ? msg->idiag_cong : "");
If you want to write this shorter next time, you can just do:
+ nl_dump(p, "congestion algorithm: %s\n", msg->idiag_cong ? : "");
More information about the libnl
mailing list