diff options
author | Toomas Soome <tsoome@me.com> | 2018-07-01 08:35:13 +0300 |
---|---|---|
committer | Richard Lowe <richlowe@richlowe.net> | 2018-08-06 19:38:36 +0000 |
commit | 6f01cc523b60037ee932665003f61f7fc34735e2 (patch) | |
tree | 008a94f8e8f57dd74d5e41752d25d31ff651ec8a /usr/src | |
parent | 5203e56b6b338ebe19cb5433c609f9f5eb7d12b7 (diff) | |
download | illumos-joyent-6f01cc523b60037ee932665003f61f7fc34735e2.tar.gz |
9636 loader: colon is not supported in zfs dataset name
Reviewed by: Yuri Pankov <yuripv@yuripv.net>
Reviewed by: Andy Fiddaman <omnios@citrus-it.co.uk>
Approved by: Richard Lowe <richlowe@richlowe.net>
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/boot/sys/boot/forth/beadm.4th | 32 | ||||
-rw-r--r-- | usr/src/boot/sys/boot/zfs/zfs.c | 2 |
2 files changed, 25 insertions, 9 deletions
diff --git a/usr/src/boot/sys/boot/forth/beadm.4th b/usr/src/boot/sys/boot/forth/beadm.4th index 31b1fe5db1..3a31841145 100644 --- a/usr/src/boot/sys/boot/forth/beadm.4th +++ b/usr/src/boot/sys/boot/forth/beadm.4th @@ -217,7 +217,8 @@ variable page_remainder exit then drop free-memory \ free type - 2dup [char] : strchr nip 0= if + \ check last char in the name + 2dup + c@ [char] : <> if \ have dataset and need to get zfs:pool/ROOT/be: dup 5 + allocate if ENOMEM throw then 0 s" zfs:" strcat @@ -288,10 +289,25 @@ variable page_remainder argc 2 = if ( activate be ) \ need to set arg list into proper order 1+ >R \ save argc+1 to return stack - \ if we have : in name, its device, inject - \ empty be name - 2dup [char] : strchr nip - if ( its : in name ) + + \ if the prefix is fd, cd, net or disk and we have : + \ in the name, it is device and inject empty be name + over 2 s" fd" compare 0= >R + over 2 s" cd" compare 0= R> or >R + over 3 s" net" compare 0= R> or >R + over 4 s" disk" compare 0= R> or + if ( prefix is fd or cd or net or disk ) + 2dup [char] : strchr nip + if ( its : in name ) + true + else + false + then + else + false + then + + if ( it is device name ) 0 0 R> else \ add device, swap with be and receive argc @@ -439,9 +455,9 @@ builtin: beadm \ for chain, use the value as is value_buffer strget else - value_buffer strget 2dup - [char] : strchr nip - 0= if + \ check last char in the name + value_buffer strget 2dup + c@ + [char] : <> if \ make zfs device name swap drop 5 + allocate if diff --git a/usr/src/boot/sys/boot/zfs/zfs.c b/usr/src/boot/sys/boot/zfs/zfs.c index 493ebd7e57..60da09a441 100644 --- a/usr/src/boot/sys/boot/zfs/zfs.c +++ b/usr/src/boot/sys/boot/zfs/zfs.c @@ -666,7 +666,7 @@ zfs_parsedev(struct zfs_devdesc *dev, const char *devspec, const char **path) if (*np != ':') return (EINVAL); np++; - end = strchr(np, ':'); + end = strrchr(np, ':'); if (end == NULL) return (EINVAL); sep = strchr(np, '/'); |