Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Jul 2014 11:38:37 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r268795 - head/usr.sbin/ctld
Message-ID:  <201407171138.s6HBcbXK024059@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Thu Jul 17 11:38:37 2014
New Revision: 268795
URL: http://svnweb.freebsd.org/changeset/base/268795

Log:
  Fix ctld crash on startup if target alias is not set.
  
  MFC after:	3 days

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

Modified: head/usr.sbin/ctld/kernel.c
==============================================================================
--- head/usr.sbin/ctld/kernel.c	Thu Jul 17 07:12:12 2014	(r268794)
+++ head/usr.sbin/ctld/kernel.c	Thu Jul 17 11:38:37 2014	(r268795)
@@ -851,9 +851,12 @@ kernel_port_add(struct target *targ)
 	req.args[0].value = &port_id;
 	req.args[0].flags = CTL_BEARG_WR;
 	str_arg(&req.args[1], "cfiscsi_target", targ->t_name);
-	str_arg(&req.args[2], "cfiscsi_target_alias", targ->t_alias);
 	snprintf(tagstr, sizeof(tagstr), "%d", targ->t_portal_group->pg_tag);
-	str_arg(&req.args[3], "cfiscsi_portal_group_tag", tagstr);
+	str_arg(&req.args[2], "cfiscsi_portal_group_tag", tagstr);
+	if (targ->t_alias)
+		str_arg(&req.args[3], "cfiscsi_target_alias", targ->t_alias);
+	else
+		req.num_args--;
 
 	error = ioctl(ctl_fd, CTL_PORT_REQ, &req);
 	free(req.args);



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