From 31354b0cb17eb8aae470a897014b427c87308f44 Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Mon, 23 Jul 2012 21:02:33 +0200 Subject: cryptsetup: fix usage of IFS Reported-by: c Reported-by: Evangelos Foutras Signed-off-by: Tom Gundersen --- functions | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/functions b/functions index c1f93f7..79e6ee0 100644 --- a/functions +++ b/functions @@ -473,18 +473,19 @@ do_unlock_legacy() { } do_unlock_systemd() { - local failed=0 + local name=$1 device=$2 password=$3 options=$4 failed=0 - if ! /usr/lib/systemd/systemd-cryptsetup attach "$1" "$2" "$3" $4; then + if ! /usr/lib/systemd/systemd-cryptsetup attach "$name" "$device" "$password" $options; then failed=1 else - if IFS=, in_array swap ${options[@]}; then + options=${options//,/ } + if in_array swap ${options[@]}; then # create swap on the device only if no fs signature exists blkid -p "$2" &>/dev/null if (( $? != 2 )) || ! mkswap /dev/mapper/$name >/dev/null; then failed=1 fi - elif IFS=, in_array tmp ${options[@]}; then + elif in_array tmp ${options[@]}; then # create fs on the device only if no fs signature exists blkid -p "$2" &>/dev/null if (( $? != 2 )) || ! mke2fs /dev/mapper/$name >/dev/null; then -- cgit v1.2.3