From e89f2b0aad809b6bfc54566a8cf353fc66524333 Mon Sep 17 00:00:00 2001 From: trasz Date: Sat, 22 Nov 2014 17:48:09 +0000 Subject: [PATCH] MFC r271320: Use keys_add_int() where appropriate. No functional changes. Sponsored by: The FreeBSD Foundation --- usr.sbin/ctld/login.c | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/usr.sbin/ctld/login.c b/usr.sbin/ctld/login.c index ad153cacdcb6..d6fd1ffa3c45 100644 --- a/usr.sbin/ctld/login.c +++ b/usr.sbin/ctld/login.c @@ -613,8 +613,7 @@ login_negotiate(struct connection *conn, struct pdu *request) struct pdu *response; struct iscsi_bhs_login_response *bhslr2; struct keys *request_keys, *response_keys; - char *portal_group_tag; - int i, rv; + int i; bool skipped_security; if (request == NULL) { @@ -641,13 +640,8 @@ login_negotiate(struct connection *conn, struct pdu *request) if (conn->conn_target->t_alias != NULL) keys_add(response_keys, "TargetAlias", conn->conn_target->t_alias); - rv = asprintf(&portal_group_tag, "%d", + keys_add_int(response_keys, "TargetPortalGroupTag", conn->conn_portal->p_portal_group->pg_tag); - if (rv <= 0) - log_err(1, "asprintf"); - keys_add(response_keys, - "TargetPortalGroupTag", portal_group_tag); - free(portal_group_tag); } for (i = 0; i < KEYS_MAX; i++) { @@ -680,8 +674,6 @@ login(struct connection *conn) struct auth_group *ag; const char *initiator_name, *initiator_alias, *session_type, *target_name, *auth_method; - char *portal_group_tag; - int rv; /* * Handle the initial Login Request - figure out required authentication @@ -860,13 +852,8 @@ login(struct connection *conn) if (conn->conn_target->t_alias != NULL) keys_add(response_keys, "TargetAlias", conn->conn_target->t_alias); - rv = asprintf(&portal_group_tag, "%d", + keys_add_int(response_keys, "TargetPortalGroupTag", conn->conn_portal->p_portal_group->pg_tag); - if (rv <= 0) - log_err(1, "asprintf"); - keys_add(response_keys, - "TargetPortalGroupTag", portal_group_tag); - free(portal_group_tag); } keys_save(response_keys, response); pdu_send(response); @@ -916,13 +903,8 @@ login(struct connection *conn) if (conn->conn_target->t_alias != NULL) keys_add(response_keys, "TargetAlias", conn->conn_target->t_alias); - rv = asprintf(&portal_group_tag, "%d", + keys_add_int(response_keys, "TargetPortalGroupTag", conn->conn_portal->p_portal_group->pg_tag); - if (rv <= 0) - log_err(1, "asprintf"); - keys_add(response_keys, - "TargetPortalGroupTag", portal_group_tag); - free(portal_group_tag); } keys_save(response_keys, response);