Also replace calls to dirname.

This commit is contained in:
mlelstv 2021-01-09 16:25:19 +00:00
parent 462cbdfa37
commit 3b6e7d0308

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# $NetBSD: 02-wedgenames,v 1.5 2021/01/09 14:00:05 mlelstv Exp $ # $NetBSD: 02-wedgenames,v 1.6 2021/01/09 16:25:19 mlelstv Exp $
# #
# Try to maintain symlinks to wedge devices # Try to maintain symlinks to wedge devices
# #
@ -81,7 +81,7 @@ remove_wedge() {
t=$(simple_readlink "$w") t=$(simple_readlink "$w")
if [ x"$t" = x"/dev/$1" ]; then if [ x"$t" = x"/dev/$1" ]; then
rm -f "$w" rm -f "$w"
basedir=$(dirname "$w") basedir=${w%/*}
rmdir -p "$basedir" 2>/dev/null rmdir -p "$basedir" 2>/dev/null
fi fi
done done
@ -95,7 +95,8 @@ add_wedge() {
n="${l#*: }" n="${l#*: }"
n=$(encode "$n") n=$(encode "$n")
test -d $wedgedir || mkdir -m 755 $wedgedir test -d $wedgedir || mkdir -m 755 $wedgedir
basedir=$(dirname "$wedgedir/$n") basedir="$wedgedir/$n"
basedir=${basedir%/*}
test -d "$basedir" || mkdir -p -m 755 "$basedir" test -d "$basedir" || mkdir -p -m 755 "$basedir"
if oldlink=$(simple_readlink "$wedgedir/$n"); then if oldlink=$(simple_readlink "$wedgedir/$n"); then
if [ x"$oldlink" != x"/dev/$1" ]; then if [ x"$oldlink" != x"/dev/$1" ]; then