aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorArshad Hussain <[email protected]>2021-04-30 02:28:49 +0530
committerGitHub <[email protected]>2021-04-29 13:58:49 -0700
commitbc9c7265ae01b970a0353cc390d4e2fb08dc7194 (patch)
treee61fffd898a2ebbcbb29d819df122bbb62703794 /cmd
parent056a658dee00cab7cd42e6146f3fa0690f07c93e (diff)
vdev_id: variable not getting expanded under map_slot()
Under function map_slot() variable passed as args were not getting properly substituted or expanded. This patch fixes the substitution issue. Reviewed-by: Niklas Edmundsson <[email protected]> Reviewed-by: Tony Hutter <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Arshad Hussain <[email protected]> Closes #11951 Closes #11959
Diffstat (limited to 'cmd')
-rwxr-xr-xcmd/vdev_id/vdev_id7
1 files changed, 4 insertions, 3 deletions
diff --git a/cmd/vdev_id/vdev_id b/cmd/vdev_id/vdev_id
index d8918da10..d349ba43c 100755
--- a/cmd/vdev_id/vdev_id
+++ b/cmd/vdev_id/vdev_id
@@ -147,8 +147,9 @@ map_slot() {
LINUX_SLOT=$1
CHANNEL=$2
- MAPPED_SLOT=$(awk '$1 == "slot" && $2 == "${LINUX_SLOT}" && \
- $4 ~ /^${CHANNEL}$|^$/ { print $3; exit}' $CONFIG)
+ MAPPED_SLOT=$(awk -v linux_slot="$LINUX_SLOT" -v channel="$CHANNEL" \
+ '$1 == "slot" && $2 == linux_slot && \
+ ($4 ~ "^"channel"$" || $4 ~ /^$/) { print $3; exit}' $CONFIG)
if [ -z "$MAPPED_SLOT" ] ; then
MAPPED_SLOT=$LINUX_SLOT
fi
@@ -163,7 +164,7 @@ map_channel() {
case $TOPOLOGY in
"sas_switch")
MAPPED_CHAN=$(awk -v port="$PORT" \
- '$1 == "channel" && $2 == ${PORT} \
+ '$1 == "channel" && $2 == port \
{ print $3; exit }' $CONFIG)
;;
"sas_direct"|"scsi")