diff --git a/usr.bin/genl/genl.c b/usr.bin/genl/genl.c --- a/usr.bin/genl/genl.c +++ b/usr.bin/genl/genl.c @@ -303,11 +303,13 @@ if (!snl_init(&ss, NETLINK_GENERIC)) err(EXIT_FAILURE, "snl_init()"); - snl_init_writer(&ss, &nw); - snl_create_genl_msg_request(&nw, GENL_ID_CTRL, CTRL_CMD_GETFAMILY); - snl_add_msg_attr_string(&nw, CTRL_ATTR_FAMILY_NAME, argv[0]); - if ((hdr = snl_finalize_msg(&nw)) == NULL) - err(EXIT_FAILURE, "snl_finalize_msg"); + if (!snl_init_writer(&ss, &nw)) + err(EXIT_FAILURE, "snl_init_writer"); + if (!snl_create_genl_msg_request(&nw, GENL_ID_CTRL, CTRL_CMD_GETFAMILY)) + err(EXIT_FAILURE, "snl_create_genl_msg_request"); + if (!snl_add_msg_attr_string(&nw, CTRL_ATTR_FAMILY_NAME, argv[0])) + err(EXIT_FAILURE, "snl_add_msg_attr_string"); + hdr = snl_finalize_msg(&nw); if (!snl_send_message(&ss, hdr)) err(EXIT_FAILURE, "snl_send_message"); hdr = snl_read_reply(&ss, hdr->nlmsg_seq); @@ -381,11 +383,11 @@ if (!snl_init(&ss, NETLINK_GENERIC)) err(EXIT_FAILURE, "snl_init()"); - snl_init_writer(&ss, &nw); - hdr = snl_create_genl_msg_request(&nw, GENL_ID_CTRL, - CTRL_CMD_GETFAMILY); - if ((hdr = snl_finalize_msg(&nw)) == NULL) - err(EXIT_FAILURE, "snl_finalize_msg"); + if (!snl_init_writer(&ss, &nw)) + err(EXIT_FAILURE, "snl_init_writer"); + if (!snl_create_genl_msg_request(&nw, GENL_ID_CTRL, CTRL_CMD_GETFAMILY)) + err(EXIT_FAILURE, "snl_create_genl_msg_request"); + hdr = snl_finalize_msg(&nw); seq_id = hdr->nlmsg_seq; if (!snl_send_message(&ss, hdr)) err(EXIT_FAILURE, "snl_send_message");