Fix ctld crash on startup if target alias is not set.
MFC after: 3 days
This commit is contained in:
parent
40dd6f486b
commit
a6f6f7a632
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=268795
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user