Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/devpubd/hooks Also replace calls to dirname.



details:   https://anonhg.NetBSD.org/src/rev/2056b552611d
branches:  trunk
changeset: 979746:2056b552611d
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sat Jan 09 16:25:19 2021 +0000

description:
Also replace calls to dirname.

diffstat:

 sbin/devpubd/hooks/02-wedgenames |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 2a839807bd2a -r 2056b552611d sbin/devpubd/hooks/02-wedgenames
--- a/sbin/devpubd/hooks/02-wedgenames  Sat Jan 09 16:06:09 2021 +0000
+++ b/sbin/devpubd/hooks/02-wedgenames  Sat Jan 09 16:25:19 2021 +0000
@@ -1,6 +1,6 @@
 #!/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
 #
@@ -81,7 +81,7 @@
                t=$(simple_readlink "$w")
                if [ x"$t" = x"/dev/$1" ]; then
                        rm -f "$w"
-                       basedir=$(dirname "$w")
+                       basedir=${w%/*}
                        rmdir -p "$basedir" 2>/dev/null
                fi
        done
@@ -95,7 +95,8 @@
                        n="${l#*: }"
                        n=$(encode "$n")
                        test -d $wedgedir || mkdir -m 755 $wedgedir
-                       basedir=$(dirname "$wedgedir/$n")
+                       basedir="$wedgedir/$n"
+                       basedir=${basedir%/*}
                        test -d "$basedir" || mkdir -p -m 755 "$basedir"
                        if oldlink=$(simple_readlink "$wedgedir/$n"); then
                                if [ x"$oldlink" != x"/dev/$1" ]; then



Home | Main Index | Thread Index | Old Index