Source-Changes-D archive

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

Re: CVS commit: src/usr.sbin/service



On Fri, 27 Mar 2015, Adrian Steinmann wrote:
Modified Files:
	src/usr.sbin/service: service

Please could this be fixed to use shell quoting in a safe way.

For example ...

+_rc_files()
{
-    local dir
-    for dir in ${rc_directories}; do
-        [ -d ${dir} ] && ls -P1 ${dir} 2>/dev/null
+    local _d _f
+    for _d in ${rc_directories}; do
+        if [ -d $_d ]; then
+            for _f in $_d/*; do [ -f $_f -a -x $_f ] && echo $_f; done
+        fi

should be ...

         if [ -d "$_d" ]; then
             for _f in "$_d"/*; do
                 [ -f "$_f" -a -x "$_f" ] && echo "$_f"
              done
         fi

--apb (Alan Barrett)


Home | Main Index | Thread Index | Old Index