Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/service More shell quoting. /etc/rc.d/* file names...



details:   https://anonhg.NetBSD.org/src/rev/d01937ca392c
branches:  trunk
changeset: 807318:d01937ca392c
user:      apb <apb%NetBSD.org@localhost>
date:      Sun Apr 05 11:33:15 2015 +0000

description:
More shell quoting.  /etc/rc.d/* file names with embedded spaces are
not expected to work, but let's quote them anyway.

diffstat:

 usr.sbin/service/service |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (50 lines):

diff -r 192e2b2e4bf4 -r d01937ca392c usr.sbin/service/service
--- a/usr.sbin/service/service  Sun Apr 05 09:24:21 2015 +0000
+++ b/usr.sbin/service/service  Sun Apr 05 11:33:15 2015 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh
-#    $NetBSD: service,v 1.6 2015/04/02 18:41:22 ast Exp $
+#    $NetBSD: service,v 1.7 2015/04/05 11:33:15 apb Exp $
 #    service -- run or list system services
 #
 #  Taken from FreeBSD: releng/10.1/usr.sbin/service/service.sh 268098
@@ -33,7 +33,7 @@
 
 usage ()
 {
-    local me=${0##*/}
+    local me="${0##*/}"
     echo "usage: ${me} [-elv]"
     echo "       ${me} [-ev] rc_script_name [rc_script_name2 [...]]"
     echo "       ${me} [-v] rc_script_name action"
@@ -60,7 +60,7 @@
 }
 
 while getopts elv o; do
-    case $o in
+    case "$o" in
         e) ENABLED=1 ;;
         l) LIST=1 ;;
         v) VERBOSE=1 ;;
@@ -83,9 +83,9 @@
     fi
     _rc_files | $flt | while read file
     do
-        if grep -q ^rcvar $file; then
-            eval $( grep ^name= $file )
-            eval $( grep ^rcvar $file )
+        if grep -q ^rcvar "$file"; then
+            eval $( grep ^name= "$file" )
+            eval $( grep ^rcvar "$file" )
             if [ -n "${rcvar}" ]; then
                 load_rc_config ${rcvar}
                 checkyesno ${rcvar} 2>/dev/null && echo ${file}
@@ -116,7 +116,7 @@
         umask 022
         exec env -i \
             HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin \
-                ${dir}/${script} ${arg}
+                "${dir}/${script}" "${arg}"
         echo "Failed to exec ${dir}/${script} ${arg}" >&2
         exit 255
     fi



Home | Main Index | Thread Index | Old Index