Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Sep 2014 16:57:03 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r271320 - head/usr.sbin/ctld
Message-ID:  <201409091657.s89Gv3X9069076@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Tue Sep  9 16:57:02 2014
New Revision: 271320
URL: http://svnweb.freebsd.org/changeset/base/271320

Log:
  Use keys_add_int() where appropriate.  No functional changes.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/usr.sbin/ctld/login.c

Modified: head/usr.sbin/ctld/login.c
==============================================================================
--- head/usr.sbin/ctld/login.c	Tue Sep  9 16:45:36 2014	(r271319)
+++ head/usr.sbin/ctld/login.c	Tue Sep  9 16:57:02 2014	(r271320)
@@ -785,8 +785,7 @@ login_negotiate(struct connection *conn,
 	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) {
@@ -813,13 +812,8 @@ login_negotiate(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);
 	}
 
 	for (i = 0; i < KEYS_MAX; i++) {
@@ -852,8 +846,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
@@ -1032,13 +1024,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);
@@ -1088,13 +1075,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);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409091657.s89Gv3X9069076>