Source-Changes-HG archive

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

[src/trunk]: src/sbin/devpubd Expunge bogus (implementation defined / unspeci...



details:   https://anonhg.NetBSD.org/src/rev/a3f16fd802a1
branches:  trunk
changeset: 1022757:a3f16fd802a1
user:      kre <kre%NetBSD.org@localhost>
date:      Thu Aug 05 12:45:33 2021 +0000

description:
Expunge bogus (implementation defined / unspecified) uses of $@ in
scripts.   $@ is unspecified except when used in a place where
field splitting can occur (which is never in an assignment),
X=$@ (with or without double quotes) is simply wrong.

Use $* instead of $@ in such places, or as here, simply change
the way things are done (very very slightly) and DTRT.

diffstat:

 sbin/devpubd/devpubd-run-hooks.in |  6 +++---
 sbin/devpubd/hooks/01-makedev     |  5 ++---
 2 files changed, 5 insertions(+), 6 deletions(-)

diffs (48 lines):

diff -r bbbdb7e0ab09 -r a3f16fd802a1 sbin/devpubd/devpubd-run-hooks.in
--- a/sbin/devpubd/devpubd-run-hooks.in Thu Aug 05 06:54:16 2021 +0000
+++ b/sbin/devpubd/devpubd-run-hooks.in Thu Aug 05 12:45:33 2021 +0000
@@ -1,19 +1,19 @@
 #!/bin/sh
 #
-# $NetBSD: devpubd-run-hooks.in,v 1.3 2015/02/15 15:56:30 jmcneill Exp $
+# $NetBSD: devpubd-run-hooks.in,v 1.4 2021/08/05 12:45:33 kre Exp $
 #
 # devpubd run hooks
 
 devpubd_event=$1
 shift
-devpubd_devices=$@
+
 devpubd_hooks_base=@HOOKSDIR@
 
 case $devpubd_event in
 device-attach|device-detach)
        for hook in ${devpubd_hooks_base}/*; do
                if [ -x "${hook}" ]; then
-                       "${hook}" ${devpubd_event} ${devpubd_devices}
+                       "${hook}" ${devpubd_event} "$@"
                fi
        done
        ;;
diff -r bbbdb7e0ab09 -r a3f16fd802a1 sbin/devpubd/hooks/01-makedev
--- a/sbin/devpubd/hooks/01-makedev     Thu Aug 05 06:54:16 2021 +0000
+++ b/sbin/devpubd/hooks/01-makedev     Thu Aug 05 12:45:33 2021 +0000
@@ -1,16 +1,15 @@
 #!/bin/sh
 #
-# $NetBSD: 01-makedev,v 1.2 2015/02/15 15:56:30 jmcneill Exp $
+# $NetBSD: 01-makedev,v 1.3 2021/08/05 12:45:33 kre Exp $
 #
 # Try to create a device node if it doesn't exist
 #
 
 event="$1"
 shift
-devices=$@
 
 case $event in
 device-attach)
-       cd /dev && sh MAKEDEV -u $devices 2>/dev/null
+       cd /dev && sh MAKEDEV -u "$@" 2>/dev/null
        ;;
 esac



Home | Main Index | Thread Index | Old Index