Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/devpubd/hooks safely update existing wedge links
details: https://anonhg.NetBSD.org/src/rev/a4e0883b275d
branches: trunk
changeset: 336440:a4e0883b275d
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Sun Mar 01 14:21:17 2015 +0000
description:
safely update existing wedge links
diffstat:
sbin/devpubd/hooks/02-wedgenames | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diffs (27 lines):
diff -r 4dd5d76535f6 -r a4e0883b275d sbin/devpubd/hooks/02-wedgenames
--- a/sbin/devpubd/hooks/02-wedgenames Sun Mar 01 13:43:51 2015 +0000
+++ b/sbin/devpubd/hooks/02-wedgenames Sun Mar 01 14:21:17 2015 +0000
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: 02-wedgenames,v 1.2 2015/02/15 15:56:30 jmcneill Exp $
+# $NetBSD: 02-wedgenames,v 1.3 2015/03/01 14:21:17 mlelstv Exp $
#
# Try to maintain symlinks to wedge devices
#
@@ -52,7 +52,14 @@
test -d $wedgedir || mkdir -m 755 $wedgedir
basedir=$(dirname "$wedgedir/$n")
test -d "$basedir" || mkdir -p -m 755 "$basedir"
- ln -s "/dev/$1" "$wedgedir/$n"
+ if oldlink=$(readlink "$wedgedir/$n"); then
+ if [ x"$oldlink" != "/dev/$1" ]; then
+ rm -f "$wedgedir/$n"
+ ln -s "/dev/$1" "$wedgedir/$n"
+ fi
+ else
+ ln -s "/dev/$1" "$wedgedir/$n"
+ fi
;;
esac
}
Home |
Main Index |
Thread Index |
Old Index